encho253

Untitled

Feb 10th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.15 KB | None | 0 0
  1.  [TestFixture]
  2.     public class EndingDateTest
  3.     {
  4.         [TestCase(null)]
  5.         public void EndingDate_ShouldThrowArgumentException_WhenPassedValueIsInvalid(string value)
  6.         {
  7.             Assert.Throws<ArgumentNullException>(() => new Course("Math", 5, DateTime.Now, DateTime.Parse(value)));
  8.         }
  9.  
  10.         [TestCase("February 01, 2017")]
  11.         [TestCase("2017/02/26")]
  12.         [TestCase("2017/02/01 18:37:58")]
  13.         [TestCase("2017 - 02 - 10")]
  14.         public void EndingDate_ShouldNotThrowException_WhenPassedValueIsValid(string value)
  15.         {
  16.             Assert.DoesNotThrow(() => new Course("Math", 5, DateTime.Now, DateTime.Parse(value)));
  17.         }
  18.  
  19.         [TestCase("February 01, 2017")]
  20.         [TestCase("2017/02/26")]
  21.         [TestCase("2017/02/01 18:37:58")]
  22.         [TestCase("2017 - 02 - 10")]
  23.         public void EndingDate_ShouldCorrectlyAssignPassedValue(string value)
  24.         {
  25.             //Arrange
  26.             ICourse course = new Course("Math", 5, DateTime.Now, DateTime.Parse(value));
  27.  
  28.             //Act and Assert
  29.             Assert.AreEqual(DateTime.Parse(value), course.EndingDate);
  30.         }
  31.     }
Advertisement
Add Comment
Please, Sign In to add comment