foxhis há 1 ano atrás
pai
commit
cd3cdf5d31

+ 1 - 0
TeaTime/TeaTime.csproj

@@ -79,6 +79,7 @@
       <DesignTime>True</DesignTime>
       <DependentUpon>Base.edmx</DependentUpon>
     </Compile>
+    <Compile Include="class%27es\Check.cs" />
     <Compile Include="class%27es\DataBaseConnect.cs" />
     <Compile Include="class%27es\DataTimeEvent.cs" />
     <Compile Include="Event.cs">

+ 49 - 0
TeaTime/class'es/Check.cs

@@ -0,0 +1,49 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace TeaTime
+{
+    public class Checks
+    {
+        public static bool checkWorker(string login, string password, out Worker worker)
+        {
+            bool check = false;
+            worker = new Worker();
+            using (KotkovaISazonovaEntities_ DB = new KotkovaISazonovaEntities_())
+            {
+                List<Worker> w = DB.Worker.ToList();
+                for (int i = 0; i < w.Count; i++)
+                {
+                    if (w[i].login == login && w[i].password == password)
+                    {
+                        check = true;
+                        worker = w[i];
+                    }
+                }
+            }
+            return check;
+        }
+        public static bool checkMember(string login, string password, out Member member)
+        {
+            bool check = false;
+            member = new Member();
+            using (KotkovaISazonovaEntities_ DB = new KotkovaISazonovaEntities_())
+            {
+                List<Member> m = DB.Member.ToList();
+                for (int i = 0; i < m.Count; i++)
+                {
+                    if (m[i].login == login && m[i].password == password)
+                    {
+                        check = true;
+                        member = m[i];
+                    }
+                }
+            }
+            return check;
+        }
+    }
+    
+}

+ 1 - 1
TeaTime/page/Authorization.xaml

@@ -3,7 +3,7 @@
       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
       xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
       xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
-      xmlns:local="clr-namespace:teaTime"
+      xmlns:local="clr-namespace:TeaTime"
       mc:Ignorable="d" 
       d:DesignHeight="450" d:DesignWidth="800"
       Title="Authorization">

+ 3 - 42
TeaTime/page/Authorization.xaml.cs

@@ -19,46 +19,7 @@ namespace teaTime
 {
     /// <summary>
     /// Логика взаимодействия для Authorization.xaml
-    /// </summary>
-    public class Check
-    {
-        public static bool checkWorker(string login, string password, out Worker worker)
-        {
-            bool check = false;
-            worker = new Worker();
-            using (KotkovaISazonovaEntities_ DB = new KotkovaISazonovaEntities_())
-            {
-                List<Worker> w = DB.Worker.ToList();
-                for (int i = 0; i < w.Count; i++)
-                {
-                    if (w[i].login == login && w[i].password == password)
-                    {
-                        check = true;
-                        worker = w[i];
-                    }
-                }
-            }
-            return check;
-        }
-        public static bool checkMember(string login, string password, out Member member)
-        {
-            bool check = false;
-            member = new Member();
-            using (KotkovaISazonovaEntities_ DB = new KotkovaISazonovaEntities_())
-            {
-                List<Member> m = DB.Member.ToList();
-                for (int i = 0; i < m.Count; i++)
-                {
-                    if (m[i].login == login && m[i].password == password)
-                    {
-                        check = true;
-                        member = m[i];
-                    }
-                }
-            }
-            return check;
-        }
-    }
+    /// </summary>    
     public partial class Authorization : Page
     {
         public Authorization()
@@ -71,11 +32,11 @@ namespace teaTime
 
         private void bAuth_Click(object sender, RoutedEventArgs e)
         {
-            if(Check.checkWorker(aLogin.Text, aPass.Password, out worker))
+            if(Checks.checkWorker(aLogin.Text, aPass.Password, out worker))
             {
                 NavigationService.Navigate(new wWorkerMain(worker));
             }
-            else if (Check.checkMember(aLogin.Text, aPass.Password, out member))
+            else if (Checks.checkMember(aLogin.Text, aPass.Password, out member))
             {
                 NavigationService.Navigate(new wMemberMain(member));
             }

+ 1 - 1
TeaTime/page/wMemberUserPrifile.xaml.cs

@@ -55,7 +55,7 @@ namespace teaTime
         {
             NavigationService.Navigate(new wMemberMain(member));
         }
-        private BindingList<Things> db;
+        
         private void tInfo_Loaded(object sender, RoutedEventArgs e)
         {
             

+ 6 - 3
UnitTestTea/UnitTest1.cs

@@ -1,8 +1,11 @@
 using Microsoft.VisualStudio.TestTools.UnitTesting;
+using TeaTime;
+using teaTime;
 using System;
 using System.Net;
+using Microsoft.Rest.ClientRuntime.Azure.Authentication.Utilities;
 
-namespace UnitTestTea
+namespace teaTime
 {
     [TestClass]
     public class UnitTest1
@@ -10,8 +13,8 @@ namespace UnitTestTea
         [TestMethod]
         public void TestTOREGISTRATION()
         {
-            bool c = new Authorization();
-            Assert.IsTrue(Authorization().(new checkWorker("even52", "1"));
+            Worker worker = new Worker();
+            Assert.IsTrue(Checks.checkWorker("even52", "1", out worker));
         }
     }
 }

+ 38 - 0
UnitTestTea/UnitTestTea.csproj

@@ -39,22 +39,60 @@
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory, Version=4.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.4.3.0\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.IdentityModel.Logging, Version=1.1.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.IdentityModel.Logging.1.1.2\lib\net451\Microsoft.IdentityModel.Logging.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.IdentityModel.Tokens, Version=5.1.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.IdentityModel.Tokens.5.1.2\lib\net451\Microsoft.IdentityModel.Tokens.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Rest.ClientRuntime.2.3.20\lib\net461\Microsoft.Rest.ClientRuntime.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Rest.ClientRuntime.Azure.Authentication, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.4.1\lib\net461\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll</HintPath>
+    </Reference>
     <Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
       <HintPath>..\packages\MSTest.TestFramework.2.2.7\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
     </Reference>
     <Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
       <HintPath>..\packages\MSTest.TestFramework.2.2.7\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
     </Reference>
+    <Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="System.Drawing" />
+    <Reference Include="System.IdentityModel" />
+    <Reference Include="System.Net" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Net.Http.WebRequest" />
+    <Reference Include="System.Runtime" />
+    <Reference Include="System.Runtime.Serialization" />
+    <Reference Include="System.Windows.Forms" />
+    <Reference Include="System.Xml" />
+    <Reference Include="System.Xml.Linq" />
   </ItemGroup>
   <ItemGroup>
     <Compile Include="UnitTest1.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
   <ItemGroup>
+    <None Include="app.config" />
     <None Include="packages.config" />
   </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\TeaTime\TeaTime.csproj">
+      <Project>{c69c8471-3eea-4d56-b7e3-6188c4979990}</Project>
+      <Name>TeaTime</Name>
+    </ProjectReference>
+  </ItemGroup>
   <Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

+ 11 - 0
UnitTestTea/app.config

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+  <runtime>
+    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+      <dependentAssembly>
+        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
+      </dependentAssembly>
+    </assemblyBinding>
+  </runtime>
+</configuration>

+ 6 - 0
UnitTestTea/packages.config

@@ -1,5 +1,11 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
+  <package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="4.3.0" targetFramework="net472" />
+  <package id="Microsoft.IdentityModel.Logging" version="1.1.2" targetFramework="net472" />
+  <package id="Microsoft.IdentityModel.Tokens" version="5.1.2" targetFramework="net472" />
+  <package id="Microsoft.Rest.ClientRuntime" version="2.3.20" targetFramework="net472" />
+  <package id="Microsoft.Rest.ClientRuntime.Azure.Authentication" version="2.4.1" targetFramework="net472" />
   <package id="MSTest.TestAdapter" version="2.2.7" targetFramework="net472" />
   <package id="MSTest.TestFramework" version="2.2.7" targetFramework="net472" />
+  <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net472" />
 </packages>