UnitTest1.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. using LoginGenerator.Models;
  2. using LoginGenerator.ViewModels;
  3. namespace UnitTestsForAssistant
  4. {
  5. public class UnitTest1
  6. {
  7. [Fact]
  8. public void PasswordIsNotNull()
  9. {
  10. PasswordGenerator pg = new PasswordGenerator();
  11. string result = pg.Execute();
  12. Assert.NotNull(result);
  13. }
  14. [Fact]
  15. public void PasswordIsStringl()
  16. {
  17. PasswordGenerator pg = new PasswordGenerator();
  18. string result = pg.Execute();
  19. Assert.IsType<string>(result);
  20. }
  21. [Fact]
  22. public void PasswordIsCorrectCount()
  23. {
  24. PasswordGenerator pg = new PasswordGenerator();
  25. string result = pg.Execute();
  26. Assert.Equal(8, result.Count());
  27. }
  28. [Fact]
  29. public void TransletirationCorrect()
  30. {
  31. Transliteration tl = new Transliteration();
  32. string result = tl.Execute("Òåñò");
  33. Assert.Equal("Test",result);
  34. }
  35. [Fact]
  36. public void TransletirationCountCorrect()
  37. {
  38. Transliteration tl = new Transliteration();
  39. string result = tl.Execute("Òåñò");
  40. Assert.Equal(4, result.Count());
  41. }
  42. [Fact]
  43. public void CheckOnSmoothCorrectOnFalse()
  44. {
  45. GeneratePageViewModel GeneratePageVM = new GeneratePageViewModel();
  46. GeneratePageVM.FIO = "TestTestTest";
  47. bool result = GeneratePageVM.CheckOnSmoothly();
  48. Assert.False(result);
  49. }
  50. [Fact]
  51. public void CheckOnSmoothCorrectOnTrue()
  52. {
  53. GeneratePageViewModel GeneratePageVM = new GeneratePageViewModel();
  54. GeneratePageVM.FIO = "Test Test Test";
  55. bool result = GeneratePageVM.CheckOnSmoothly();
  56. Assert.True(result);
  57. }
  58. [Fact]
  59. public void CheckSortOnContains()
  60. {
  61. DataOutputViewModel DataOutputVM = new DataOutputViewModel();
  62. Assert.Contains<string>("Äàòà ïî óáûâàíèþ",DataOutputViewModel.Sort);
  63. }
  64. [Fact]
  65. public void CheckSortOnContains2()
  66. {
  67. DataOutputViewModel DataOutputVM = new DataOutputViewModel();
  68. Assert.Contains<string>("Äàòà ïî âîçðàñòàíèþ", DataOutputViewModel.Sort);
  69. }
  70. [Fact]
  71. public void CheclSelectedSortOnCorrect()
  72. {
  73. DataOutputViewModel DataOutputVM = new DataOutputViewModel();
  74. Assert.Equal("Äàòà ïî óáûâàíèþ",DataOutputVM.SelectedSort);
  75. }
  76. }
  77. }