Просмотр исходного кода

Добавьте файлы проекта.

Fox 7 месяцев назад
Родитель
Сommit
27ba12df40
4 измененных файлов с 142 добавлено и 0 удалено
  1. 1 0
      GlobalUsings.cs
  2. 87 0
      UnitTest1.cs
  3. 29 0
      UnitTestsForAssistant.csproj
  4. 25 0
      UnitTestsForAssistant.sln

+ 1 - 0
GlobalUsings.cs

@@ -0,0 +1 @@
+global using Xunit;

+ 87 - 0
UnitTest1.cs

@@ -0,0 +1,87 @@
+using LoginGenerator.Models;
+using LoginGenerator.ViewModels;
+
+namespace UnitTestsForAssistant
+{
+    public class UnitTest1
+    {
+        [Fact]
+        public void PasswordIsNotNull()
+        {
+            PasswordGenerator pg = new PasswordGenerator();
+            string result = pg.Execute();
+            Assert.NotNull(result);
+        }
+
+        [Fact]
+        public void PasswordIsStringl()
+        {
+            PasswordGenerator pg = new PasswordGenerator();
+            string result = pg.Execute();
+            Assert.IsType<string>(result);
+        }
+
+        [Fact]
+        public void PasswordIsCorrectCount()
+        {
+            PasswordGenerator pg = new PasswordGenerator();
+            string result = pg.Execute();
+            Assert.Equal(8, result.Count());
+        }
+
+        [Fact]
+        public void TransletirationCorrect()
+        {
+            Transliteration tl = new Transliteration();
+            string result = tl.Execute("Òåñò");
+            Assert.Equal("Test",result);
+        }
+
+        [Fact]
+        public void TransletirationCountCorrect()
+        {
+            Transliteration tl = new Transliteration();
+            string result = tl.Execute("Òåñò");
+            Assert.Equal(4, result.Count());
+        }
+
+        [Fact]
+        public void CheckOnSmoothCorrectOnFalse()
+        {
+            GeneratePageViewModel GeneratePageVM = new GeneratePageViewModel();
+            GeneratePageVM.FIO = "TestTestTest";
+            bool result = GeneratePageVM.CheckOnSmoothly();
+            Assert.False(result);
+        }
+
+        [Fact]
+        public void CheckOnSmoothCorrectOnTrue()
+        {
+            GeneratePageViewModel GeneratePageVM = new GeneratePageViewModel();
+            GeneratePageVM.FIO = "Test Test Test";
+            bool result = GeneratePageVM.CheckOnSmoothly();
+            Assert.True(result);
+        }
+
+        [Fact]
+        public void CheckSortOnContains()
+        {
+            DataOutputViewModel DataOutputVM = new DataOutputViewModel();
+            Assert.Contains<string>("Äàòà ïî óáûâàíèþ",DataOutputViewModel.Sort);
+        }
+
+        [Fact]
+        public void CheckSortOnContains2()
+        {
+            DataOutputViewModel DataOutputVM = new DataOutputViewModel();
+            Assert.Contains<string>("Äàòà ïî âîçðàñòàíèþ", DataOutputViewModel.Sort);
+        }
+
+        [Fact]
+        public void CheclSelectedSortOnCorrect()
+        {
+            DataOutputViewModel DataOutputVM = new DataOutputViewModel();
+            Assert.Equal("Äàòà ïî óáûâàíèþ",DataOutputVM.SelectedSort);
+        }
+    }
+}

+ 29 - 0
UnitTestsForAssistant.csproj

@@ -0,0 +1,29 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFramework>net7.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+
+    <IsPackable>false</IsPackable>
+    <IsTestProject>true</IsTestProject>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.1" />
+    <PackageReference Include="xunit" Version="2.4.2" />
+    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
+      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+      <PrivateAssets>all</PrivateAssets>
+    </PackageReference>
+    <PackageReference Include="coverlet.collector" Version="3.2.0">
+      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+      <PrivateAssets>all</PrivateAssets>
+    </PackageReference>
+  </ItemGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\LoginGenerator\LoginGenerator.csproj" />
+  </ItemGroup>
+
+</Project>

+ 25 - 0
UnitTestsForAssistant.sln

@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.7.34221.43
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestsForAssistant", "UnitTestsForAssistant.csproj", "{59A4964A-B910-4B97-8B9A-2B56B1AFD4CE}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{59A4964A-B910-4B97-8B9A-2B56B1AFD4CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{59A4964A-B910-4B97-8B9A-2B56B1AFD4CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{59A4964A-B910-4B97-8B9A-2B56B1AFD4CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{59A4964A-B910-4B97-8B9A-2B56B1AFD4CE}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {27C1D0F4-39F6-40B2-B8C5-AE8D9D9786F3}
+	EndGlobalSection
+EndGlobal