Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using Program.Models;
- namespace UnitTest
- {
- [TestClass]
- public class UnitTest1
- {
- [TestMethod]
- public void FromStringArrayToStringTest()
- {
- // arrange
- string[] firstIntputStrings = new string[] { "21/07/2018", "22/07/2018" };
- string[] secondIntputStrings = new string[] { "12/08/2018", "07/10/2018" };
- string[] thirdIntputStrings = new string[] { "02/05/2018", "11/01/2019" };
- string firstExpectedOutputRange = "21 - 22.07.2018";
- string secondExpectedOutputRange = "12.08 - 07.10.2018";
- string thirdExpectedOutputRange = "02.05.2018 - 11.01.2019";
- // act
- DateSpan firstDateSpan = DateSpan.FromStringArray(firstIntputStrings);
- DateSpan secondDateSpan = DateSpan.FromStringArray(secondIntputStrings);
- DateSpan thirdDateSpan = DateSpan.FromStringArray(thirdIntputStrings);
- string firstOutputRange = firstDateSpan.ToString();
- string secondOutputRange = secondDateSpan.ToString();
- string thirdOutputRange = thirdDateSpan.ToString();
- // assert
- Assert.AreEqual(firstExpectedOutputRange, firstOutputRange);
- Assert.AreEqual(secondExpectedOutputRange, secondOutputRange);
- Assert.AreEqual(thirdExpectedOutputRange, thirdOutputRange);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement