mr.solder5 5 years ago
parent
commit
b0a47fff57

+ 3 - 1
CopyCenter/AuthorizationWindow.xaml.cs

@@ -19,6 +19,7 @@ namespace CopyCenter
     /// </summary>
     /// </summary>
     public partial class AuthorizationWindow : Window
     public partial class AuthorizationWindow : Window
     {
     {
+
         gr672_liiEntities db;
         gr672_liiEntities db;
         public AuthorizationWindow()
         public AuthorizationWindow()
         {
         {
@@ -62,7 +63,7 @@ namespace CopyCenter
             Application.Current.Shutdown();
             Application.Current.Shutdown();
         }
         }
 
 
-        private bool Auth(string login, string password)
+        public bool Auth(string login, string password)
         {
         {
             if (login == "" || password == "")
             if (login == "" || password == "")
             {
             {
@@ -84,5 +85,6 @@ namespace CopyCenter
             }
             }
         }
         }
 
 
+
     }
     }
 }
 }

+ 4 - 0
CopyCenterTests/CopyCenterTests.csproj

@@ -45,9 +45,13 @@
     <Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
     <Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
       <HintPath>..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
       <HintPath>..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
     </Reference>
     </Reference>
+    <Reference Include="PresentationCore" />
     <Reference Include="PresentationFramework" />
     <Reference Include="PresentationFramework" />
     <Reference Include="System" />
     <Reference Include="System" />
     <Reference Include="System.Core" />
     <Reference Include="System.Core" />
+    <Reference Include="WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\WindowsBase.4.6.1055.0\lib\WindowsBase.dll</HintPath>
+    </Reference>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <Compile Include="UnitTest1.cs" />
     <Compile Include="UnitTest1.cs" />

+ 2 - 75
CopyCenterTests/UnitTest1.cs

@@ -19,82 +19,9 @@ namespace CopyCenterTests
         {
         {
             var Authorization = new AuthorizationWindow();
             var Authorization = new AuthorizationWindow();
             var Clients = new ClientsWindow();
             var Clients = new ClientsWindow();
-            Assert.IsFalse(Authorization.Auth("test", "123"));
-            Assert.IsTrue(Authorization.Auth("max", "123"));
+            Assert.IsFalse(Authorization.Auth("", ""));
+            Assert.IsTrue(Authorization.Auth("PaNDa", "123"));
         }
         }
     }
     }
-    public class Authorization
-    {
-        gr672_liiEntities db = new gr672_liiEntities();
-        public bool Auth(string login, string password)
-        {
-           
-            if (login == "" || password == "")
-            {
-                return false;
-            }
-            if (db.Users.Select(item => item.Login + " " + item.Password).Contains(login + " " + password))
-            {
-                return true;
-            }
-            else
-            {
-                return false;
-            }
-
-        }
-    }
-
-    public class Window1
-    {
-        gr672_liiEntities db = new gr672_liiEntities();
-        public bool Insert(string login, string password, string last_name, string first_name)
-        {
-            if (db.User.Select(item => item.Login + " " + item.Password + item.LastName + item.FirstName).Contains(login + " " + password + last_name + first_name))
-            {
-                return true;
-            }
-            if (login == "" || password == "")
-            {
-                return false;
-            }
-            else
-            {
-                return false;
-            }
-        }
-        public bool Update(string login, string password, string last_name, string first_name)
-        {
-            if (db.User.Select(item => item.Login + " " + item.Password + item.LastName + item.FirstName).Contains(login + " " + password + last_name + first_name))
-            {
-                return true;
-            }
-            if (login == "" || password == "")
-            {
-                return false;
-            }
-            else
-            {
-                return false;
-            }
-        }
-        public bool Delete(string login, string password)
-        {
 
 
-            if (login == "" || password == "")
-            {
-                return true;
-            }
-            if (db.User.Select(item => item.Login + " " + item.Password).Contains(login + " " + password))
-            {
-                return false;
-            }
-            else
-            {
-                return true;
-            }
-        }
-    }
 }
 }
-}
-

+ 1 - 0
CopyCenterTests/packages.config

@@ -2,4 +2,5 @@
 <packages>
 <packages>
   <package id="MSTest.TestAdapter" version="1.3.2" targetFramework="net472" />
   <package id="MSTest.TestAdapter" version="1.3.2" targetFramework="net472" />
   <package id="MSTest.TestFramework" version="1.3.2" targetFramework="net472" />
   <package id="MSTest.TestFramework" version="1.3.2" targetFramework="net472" />
+  <package id="WindowsBase" version="4.6.1055.0" targetFramework="net472" />
 </packages>
 </packages>