Bladeren bron

Unit tests added

Imagara 3 jaren geleden
bovenliggende
commit
81311f0624

+ 8 - 2
Encrypter.sln

@@ -1,10 +1,12 @@
 
 Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 17
-VisualStudioVersion = 17.0.32112.339
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31911.196
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Encrypter", "Encrypter\Encrypter.csproj", "{CCB8CBF2-14CB-427A-9AD1-4704F038939C}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestProject", "UnitTestProject\UnitTestProject.csproj", "{E227769C-5004-41D1-9946-0EC49EE2E676}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -15,6 +17,10 @@ Global
 		{CCB8CBF2-14CB-427A-9AD1-4704F038939C}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{CCB8CBF2-14CB-427A-9AD1-4704F038939C}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{CCB8CBF2-14CB-427A-9AD1-4704F038939C}.Release|Any CPU.Build.0 = Release|Any CPU
+		{E227769C-5004-41D1-9946-0EC49EE2E676}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{E227769C-5004-41D1-9946-0EC49EE2E676}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{E227769C-5004-41D1-9946-0EC49EE2E676}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{E227769C-5004-41D1-9946-0EC49EE2E676}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 1 - 1
Encrypter/App.xaml

@@ -4,6 +4,6 @@
              xmlns:local="clr-namespace:Encrypter"
              StartupUri="MainWindow.xaml">
     <Application.Resources>
-         
+        
     </Application.Resources>
 </Application>

+ 54 - 138
Encrypter/MainWindow.xaml

@@ -11,158 +11,74 @@
         ResizeMode="NoResize"
         WindowStartupLocation="CenterScreen"
         WindowStyle="SingleBorderWindow">
-    <Grid>
-        <TabControl>
-            <TabItem Height="40"
-                     Width="120">
-                <TabItem.Header>
-                    <Label FontSize="14"
-                           Content="1 способ"/>
-                </TabItem.Header>
-                <Grid 
-                    Background="#FFE5E5E5"
-                    Margin="5">
-                    <Grid.ColumnDefinitions>
-                        <ColumnDefinition/>
-                        <ColumnDefinition/>
-                    </Grid.ColumnDefinitions>
-                    <StackPanel Orientation="Vertical"
+    <Grid Background="#FFE5E5E5" 
+          Margin="15">
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition/>
+            <ColumnDefinition Width="140"/>
+            <ColumnDefinition/>
+        </Grid.ColumnDefinitions>
+        <StackPanel Orientation="Vertical"
                                 VerticalAlignment="Center"
                                 HorizontalAlignment="Center"
                                 Grid.Column="0">
-                        <Label Content="Ввод"/>
-                        <TextBox Name="sposob1_input"
+            <Label Content="Ввод"
+                   FontSize="16"/>
+            <TextBox Name="Encryptinput"
                                  Width="200" 
                                  Height="40"/>
-                        <Label Content="Результат"/>
-                        <TextBox Name="sposob1_output"
+            <Label Content="Результат"
+                   FontSize="16"/>
+            <TextBox Name="Encryptoutput"
                                  Width="200" 
                                  Height="40"/>
-                        <Button Width="200"
+            <Button Width="200"
                                 Height="40"
                                 Content="Зашифровать"
-                                Click="sposob1_encrypt"/>
-                    </StackPanel>
-                    
-                    <StackPanel Orientation="Vertical"
-                                VerticalAlignment="Center"
-                                HorizontalAlignment="Center"
-                                Grid.Column="1">
-                        <Label Content="Ввод"/>
-                        <TextBox Name="sposob1_input2"
-                                 Width="200" 
-                                 Height="40"/>
-                        <Label Content="Результат"/>
-                        <TextBox Name="sposob1_output2"
-                                 Width="200" 
-                                 Height="40"/>
-                        <Button Width="200"
-                                Height="40"
-                                Content="Расшифровать"
-                                Click="sposob1_decrypt"/>
-                    </StackPanel>
-                </Grid>
-            </TabItem>
-            <TabItem Height="40" 
-                     Width="120">
-                <TabItem.Header>
-                    <Label FontSize="14" 
-                           Content="2 способ"/>
-                </TabItem.Header>
-                <Grid 
-                    Background="#FFE5E5E5"
-                    Margin="5">
-                    <Grid.ColumnDefinitions>
-                        <ColumnDefinition/>
-                        <ColumnDefinition/>
-                    </Grid.ColumnDefinitions>
-                    <StackPanel Orientation="Vertical"
-                                VerticalAlignment="Center"
-                                HorizontalAlignment="Center"
-                                Grid.Column="0">
-                        <Label Content="Ввод"/>
-                        <TextBox Name="sposob2_input"
-                                 Width="200" 
-                                 Height="40"/>
-                        <Label Content="Результат"/>
-                        <TextBox Name="sposob2_output"
-                                 Width="200" 
-                                 Height="40"/>
-                        <Button Width="200"
-                                Height="40"
-                                Content="Зашифровать"
-                                Click="sposob2_encrypt"/>
-                    </StackPanel>
-
-                    <StackPanel Orientation="Vertical"
-                                VerticalAlignment="Center"
-                                HorizontalAlignment="Center"
-                                Grid.Column="1">
-                        <Label Content="Ввод"/>
-                        <TextBox Name="sposob2_input2"
-                                 Width="200" 
-                                 Height="40"/>
-                        <Label Content="Результат"/>
-                        <TextBox x:Name="sposob2_output2"
-                                 Width="200" 
-                                 Height="40"/>
-                        <Button Width="200"
-                                Height="40"
-                                Content="Расшифровать"
-                                Click="sposob2_decrypt"/>
-                    </StackPanel>
-                </Grid>
-            </TabItem>
-            <TabItem Height="40" 
-                     Width="120">
-                <TabItem.Header>
-                    <Label FontSize="14" 
-                           Content="3 способ"/>
-                </TabItem.Header>
-                <Grid
-                    Background="#FFE5E5E5"
-                    Margin="5">
-                    <Grid.ColumnDefinitions>
-                        <ColumnDefinition/>
-                        <ColumnDefinition/>
-                    </Grid.ColumnDefinitions>
-                    <StackPanel Orientation="Vertical"
-                                VerticalAlignment="Center"
-                                HorizontalAlignment="Center"
-                                Grid.Column="0">
-                        <Label Content="Ввод"/>
-                        <TextBox Name="sposob3_input"
-                                 Width="200" 
-                                 Height="40"/>
-                        <Label Content="Результат"/>
-                        <TextBox Name="sposob3_output"
-                                 Width="200" 
-                                 Height="40"/>
-                        <Button Width="200"
-                                Height="40"
-                                Content="Зашифровать"
-                                Click="sposob3_encrypt"/>
-                    </StackPanel>
-
-                    <StackPanel Orientation="Vertical"
-                                VerticalAlignment="Center"
-                                HorizontalAlignment="Center"
-                                Grid.Column="1">
-                        <Label Content="Ввод"/>
-                        <TextBox Name="sposob3_input2"
+                                Click="EncryptClick"/>
+        </StackPanel>
+        
+        <StackPanel Grid.Column="1"
+                    VerticalAlignment="Center"
+                    HorizontalAlignment="Center">
+            <TextBlock Text="Выбор способа шифрования"
+                       TextWrapping="Wrap"
+                       FontSize="20" 
+                       Height="58"
+                       Width="180"/>
+            <RadioButton GroupName="Encrypt" 
+                         Content="1 Способ" 
+                         Checked="RadioButton_Checked"
+                         FontSize="16"
+                         IsChecked="True"/>
+            <RadioButton GroupName="Encrypt" 
+                         Content="2 Способ" 
+                         Checked="RadioButton_Checked"
+                         FontSize="16"/>
+            <RadioButton GroupName="Encrypt" 
+                         Content="3 Способ" 
+                         Checked="RadioButton_Checked"
+                         FontSize="16"/>
+        </StackPanel>
+        
+        <StackPanel Orientation="Vertical"
+                    VerticalAlignment="Center"
+                    HorizontalAlignment="Center"
+                    Grid.Column="2">
+            <Label Content="Ввод"
+                   FontSize="16"/>
+            <TextBox Name="Decryptinput"
                                  Width="200" 
                                  Height="40"/>
-                        <Label Content="Результат"/>
-                        <TextBox Name="sposob3_output2"
+            <Label Content="Результат"
+                   FontSize="16"/>
+            <TextBox Name="Decryptoutput"
                                  Width="200" 
                                  Height="40"/>
-                        <Button Width="200"
+            <Button Width="200"
                                 Height="40"
                                 Content="Расшифровать"
-                                Click="sposob3_decrypt"/>
-                    </StackPanel>
-                </Grid>
-            </TabItem>
-        </TabControl>
+                                Click="DecryptClick"/>
+        </StackPanel>
     </Grid>
 </Window>

+ 96 - 70
Encrypter/MainWindow.xaml.cs

@@ -3,105 +3,131 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Windows;
+using System.Windows.Controls;
 
 namespace Encrypter
 {
     public partial class MainWindow : Window
     {
         Encoding ascii = Encoding.ASCII;
-
+        RadioButton pressed = new RadioButton();
         public MainWindow()
         {
             InitializeComponent();
+            pressed.Content = "1 Способ";
         }
-        private void sposob1_encrypt(object sender, RoutedEventArgs e)
+        private void EncryptClick(object sender, RoutedEventArgs e)
         {
-            string input = sposob1_input.Text, output = "";
-
-            Dictionary<char, int> dictionarys = input.GroupBy(x => x).ToDictionary(x => x.Key, x => x.Count());
-            int uniqueSymbCount = dictionarys.Count();
-
-            Byte[] encodedBytes = ascii.GetBytes(input);
-            foreach (Byte b in encodedBytes)
-                output += $"{b + Convert.ToInt32(dictionarys.Where(item => item.Key == Convert.ToChar(b)).Select(item => item.Value).FirstOrDefault())}%";
-            sposob1_output.Text = output;
+            Encryptoutput.Text = Encrypt(Encryptinput.Text, Convert.ToInt32(pressed.Content.ToString().Substring(0, 1)));
+            Decryptinput.Text = Encryptoutput.Text;
         }
-
-        public int CountOfCoincidences(string a, string[] mass)
+        private void DecryptClick(object sender, RoutedEventArgs e)
         {
-            int count = 0;
-            for (int i = 0; i < mass.Length; i++)
-                if (mass[i] == a)
-                    count++;
-            return count;
+            Decryptoutput.Text = Decrypt(Decryptinput.Text, Convert.ToInt32(pressed.Content.ToString().Substring(0, 1)));
         }
 
-        private void sposob1_decrypt(object sender, RoutedEventArgs e)
+        public string Encrypt(string input, int way)
         {
-            string input = sposob1_input2.Text, output = "";
-            string[] mass = input.Remove(input.Length - 1, 1).Split('%');
-
-            int[,] array = new int[mass.Length, 2];
-
-            for (int i = 0; i < mass.Length; i++)
+            string output = "";
+            Byte[] encodedBytes;
+            try
             {
-                array[i, 0] = Convert.ToInt32(mass[i]);
-                array[i, 1] = CountOfCoincidences(mass[i], mass);
+                switch (way)
+                {
+                    case 1:
+                        Dictionary<char, int> dictionarys = input.GroupBy(x => x).ToDictionary(x => x.Key, x => x.Count());
+                        encodedBytes = ascii.GetBytes(input);
+                        foreach (Byte b in encodedBytes)
+                            output += $"{b + Convert.ToInt32(dictionarys.Where(item => item.Key == Convert.ToChar(b)).Select(item => item.Value).FirstOrDefault())}%";
+                        break;
+                    case 2:
+                        int pos = 0;
+                        encodedBytes = ascii.GetBytes(input);
+                        foreach (Byte b in encodedBytes)
+                        {
+                            output += $"{b + pos}%";
+                            pos++;
+                        }
+                        break;
+                    case 3:
+                        encodedBytes = ascii.GetBytes(input);
+                        foreach (Byte b in encodedBytes)
+                            output += $"{b + input.Length}%{input.Length}^?";
+                        break;
+                }
             }
-
-            for (int i = 0; i < mass.Length; i++)
-                output += Convert.ToChar(Convert.ToByte(array[i, 0] - array[i, 1]));
-
-            sposob1_output2.Text = output;
-        }
-        private void sposob2_encrypt(object sender, RoutedEventArgs e)
-        {
-            string input = sposob2_input.Text, output = "";
-            int pos = 0;
-
-            Byte[] encodedBytes = ascii.GetBytes(input);
-            foreach (Byte b in encodedBytes)
+            catch (Exception ex)
             {
-                output += $"{b + pos}%";
-                pos++;
+                MessageBox.Show("Ошибка шифрования. " + ex.ToString());
             }
-            sposob2_output.Text = output;
+
+            return output;
         }
-        private void sposob2_decrypt(object sender, RoutedEventArgs e)
+        public string Decrypt(string input, int way)
         {
-            string input = sposob2_input2.Text, output = "";
-            int pos = 0;
+            string output = "";
+            try
+            {
+                switch (way)
+                {
+                    case 1:
+                        string[] mass = input.Remove(input.Length-1, 1).Split('%');
+
+                        int[,] array = new int[mass.Length, 2];
+
+                        for (int i = 0; i < mass.Length; i++)
+                        {
+                            array[i, 0] = Convert.ToInt32(mass[i]);
+                            array[i, 1] = CountOfCoincidences(mass[i], mass);
+                        }
+
+                        for (int i = 0; i < mass.Length; i++)
+                            output += Convert.ToChar(Convert.ToByte(array[i, 0] - array[i, 1]));
+
+                        break;
+                    case 2:
+                        int pos = 0;
 
-            while (input.IndexOf('%') != -1)
+                        while (input.IndexOf('%') != -1)
+                        {
+                            byte temp = Convert.ToByte(Convert.ToInt32(input.Substring(0, input.IndexOf('%'))) - pos);
+                            pos++;
+                            output += Convert.ToChar(temp);
+                            input = input.Remove(0, input.IndexOf('%') + 1);
+                        }
+                        break;
+                    case 3:
+                        int count = input.Count(c => c == '%');
+
+                        while (input.IndexOf($"%{count}^?") != -1)
+                        {
+                            byte temp = Convert.ToByte(Convert.ToInt32(input.Substring(0, input.IndexOf($"%{count}^?"))) - count);
+                            output += Convert.ToChar(temp);
+                            input = input.Remove(0, input.IndexOf($"%{count}^?") + 3 + count.ToString().Length);
+                        }
+                        break;
+                }
+            }
+            catch (Exception ex)
             {
-                byte temp = Convert.ToByte(Convert.ToInt32(input.Substring(0, input.IndexOf('%'))) - pos);
-                pos++;
-                output += Convert.ToChar(temp);
-                input = input.Remove(0, input.IndexOf('%') + 1);
+                MessageBox.Show("Ошибка расшифровки. " + ex.ToString());
             }
-            sposob2_output2.Text = output;
-        }
-        private void sposob3_encrypt(object sender, RoutedEventArgs e)
-        {
-            string input = sposob3_input.Text, output = "";
 
-            Byte[] encodedBytes = ascii.GetBytes(input);
-            foreach (Byte b in encodedBytes)
-                output += $"{b + input.Length}%{input.Length}^?";
-            sposob3_output.Text = output;
+            return output;
         }
-        private void sposob3_decrypt(object sender, RoutedEventArgs e)
+
+        public int CountOfCoincidences(string a, string[] mass)
         {
-            string input = sposob3_input2.Text, output = "";
-            int count = input.Count(c => c == '%');
+            int count = 0;
+            for (int i = 0; i < mass.Length; i++)
+                if (mass[i] == a)
+                    count++;
+            return count;
+        }
 
-            while (input.IndexOf($"%{count}^?") != -1)
-            {
-                byte temp = Convert.ToByte(Convert.ToInt32(input.Substring(0, input.IndexOf($"%{count}^?"))) - count);
-                output += Convert.ToChar(temp);
-                input = input.Remove(0, input.IndexOf($"%{count}^?") + 3 + count.ToString().Length);
-            }
-            sposob3_output2.Text = output;
+        private void RadioButton_Checked(object sender, RoutedEventArgs e)
+        {
+            pressed = (RadioButton)sender;
         }
     }
 }

+ 20 - 0
UnitTestProject/Properties/AssemblyInfo.cs

@@ -0,0 +1,20 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("UnitTestProject")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("UnitTestProject")]
+[assembly: AssemblyCopyright("Copyright ©  2022")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+[assembly: ComVisible(false)]
+
+[assembly: Guid("e227769c-5004-41d1-9946-0ec49ee2e676")]
+
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 57 - 0
UnitTestProject/UnitTest1.cs

@@ -0,0 +1,57 @@
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Encrypter;
+namespace UnitTestProject
+{
+    [TestClass]
+    public class UnitTest1
+    {
+        [TestMethod]
+        public void Encrypt1Test()
+        {
+            string str = "Some simple text";
+            string expected = "84%112%111%104%34%116%106%111%113%109%104%34%118%104%121%118%";
+            int way = 1;
+            Assert.AreEqual(new MainWindow().Encrypt(str, way), expected);
+        }
+        [TestMethod]
+        public void Decrypt1Test()
+        {
+            string str = "84%112%111%104%34%116%106%111%113%109%104%34%118%104%121%118%";
+            string expected = "Some simple text";
+            int way = 1;
+            Assert.AreEqual(new MainWindow().Decrypt(str, way), expected);
+        }
+        [TestMethod]
+        public void Encrypt2Test()
+        {
+            string str = "Some simple text";
+            string expected = "83%112%111%104%36%120%111%116%120%117%111%43%128%114%134%131%";
+            int way = 2;
+            Assert.AreEqual(new MainWindow().Encrypt(str, way), expected);
+        }
+        [TestMethod]
+        public void Decrypt2Test()
+        {
+            string str = "83%112%111%104%36%120%111%116%120%117%111%43%128%114%134%131%";
+            string expected = "Some simple text";
+            int way = 2;
+            Assert.AreEqual(new MainWindow().Decrypt(str, way), expected);
+        }
+        [TestMethod]
+        public void Encrypt3Test()
+        {
+            string str = "Some simple text";
+            string expected = "99%16^?127%16^?125%16^?117%16^?48%16^?131%16^?121%16^?125%16^?128%16^?124%16^?117%16^?48%16^?132%16^?117%16^?136%16^?132%16^?";
+            int way = 3;
+            Assert.AreEqual(new MainWindow().Encrypt(str, way), expected);
+        }
+        [TestMethod]
+        public void Decrypt3Test()
+        {
+            string str = "99%16^?127%16^?125%16^?117%16^?48%16^?131%16^?121%16^?125%16^?128%16^?124%16^?117%16^?48%16^?132%16^?117%16^?136%16^?132%16^?";
+            string expected = "Some simple text";
+            int way = 3;
+            Assert.AreEqual(new MainWindow().Decrypt(str, way), expected);
+        }
+    }
+}

+ 77 - 0
UnitTestProject/UnitTestProject.csproj

@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props')" />
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{E227769C-5004-41D1-9946-0EC49EE2E676}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>UnitTestProject</RootNamespace>
+    <AssemblyName>UnitTestProject</AssemblyName>
+    <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
+    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
+    <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
+    <IsCodedUITest>False</IsCodedUITest>
+    <TestProjectType>UnitTest</TestProjectType>
+    <NuGetPackageImportStamp>
+    </NuGetPackageImportStamp>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\MSTest.TestFramework.2.1.2\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.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
+    </Reference>
+    <Reference Include="PresentationCore" />
+    <Reference Include="PresentationFramework" />
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="WindowsBase" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="UnitTest1.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="packages.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\Encrypter\Encrypter.csproj">
+      <Project>{ccb8cbf2-14cb-427a-9ad1-4704f038939c}</Project>
+      <Name>Encrypter</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">
+    <PropertyGroup>
+      <ErrorText>Данный проект ссылается на пакеты NuGet, отсутствующие на этом компьютере. Используйте восстановление пакетов NuGet, чтобы скачать их.  Дополнительную информацию см. по адресу: http://go.microsoft.com/fwlink/?LinkID=322105. Отсутствует следующий файл: {0}.</ErrorText>
+    </PropertyGroup>
+    <Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props'))" />
+    <Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets'))" />
+  </Target>
+  <Import Project="..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets')" />
+</Project>

+ 5 - 0
UnitTestProject/packages.config

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="MSTest.TestAdapter" version="2.1.2" targetFramework="net472" />
+  <package id="MSTest.TestFramework" version="2.1.2" targetFramework="net472" />
+</packages>