Advertisement
Guest User

Untitled

a guest
Mar 13th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. using System;
  2. using Microsoft.VisualStudio.TestTools.UnitTesting;
  3. using Program.Models;
  4.  
  5. namespace UnitTest
  6. {
  7. [TestClass]
  8. public class UnitTest1
  9. {
  10. [TestMethod]
  11. public void FromStringArrayToStringTest()
  12. {
  13. // arrange
  14. string[] firstIntputStrings = new string[] { "21/07/2018", "22/07/2018" };
  15. string[] secondIntputStrings = new string[] { "12/08/2018", "07/10/2018" };
  16. string[] thirdIntputStrings = new string[] { "02/05/2018", "11/01/2019" };
  17.  
  18. string firstExpectedOutputRange = "21 - 22.07.2018";
  19. string secondExpectedOutputRange = "12.08 - 07.10.2018";
  20. string thirdExpectedOutputRange = "02.05.2018 - 11.01.2019";
  21.  
  22. // act
  23. DateSpan firstDateSpan = DateSpan.FromStringArray(firstIntputStrings);
  24. DateSpan secondDateSpan = DateSpan.FromStringArray(secondIntputStrings);
  25. DateSpan thirdDateSpan = DateSpan.FromStringArray(thirdIntputStrings);
  26.  
  27. string firstOutputRange = firstDateSpan.ToString();
  28. string secondOutputRange = secondDateSpan.ToString();
  29. string thirdOutputRange = thirdDateSpan.ToString();
  30.  
  31. // assert
  32. Assert.AreEqual(firstExpectedOutputRange, firstOutputRange);
  33. Assert.AreEqual(secondExpectedOutputRange, secondOutputRange);
  34. Assert.AreEqual(thirdExpectedOutputRange, thirdOutputRange);
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement