encho253

Untitled

Feb 10th, 2017
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.00 KB | None | 0 0
  1. namespace Academy.Tests.ModelsTest.CourseTest
  2. {
  3.     [TestFixture]
  4.     public class LecturesPerWeekTest
  5.     {
  6.         [TestCase(0)]
  7.         [TestCase(-1)]
  8.         [TestCase(-15)]
  9.         [TestCase(8)]
  10.         [TestCase(12)]
  11.         public void LecturesPerWeek_ShouldThrowArgumentException_WhenPassedValueIsInvalid(int value)
  12.         {
  13.             Assert.Throws<ArgumentException>(() => new Course("Math", value, DateTime.Today, DateTime.Now));
  14.         }
  15.  
  16.         [TestCase(1)]
  17.         [TestCase(2)]
  18.         [TestCase(3)]
  19.         [TestCase(6)]
  20.         [TestCase(7)]
  21.         public void LecturesPerWeek_ShouldNotThrowException_WhenPassedValueIsValid(int value)
  22.         {
  23.             Assert.DoesNotThrow(() => new Course("Math", value, DateTime.Today, DateTime.Now));
  24.         }
  25.     }
  26. }
  27.  
  28. namespace Academy.Tests.ModelsTest.CourseTest
  29. {
  30.     [TestFixture]
  31.     public class StartingDateTest
  32.     {
  33.         [TestCase(null)]
  34.         public void StartingDate_ShouldThrowArgumentNullException_WhenPassedValueIsInvalid(string value)
  35.         {
  36.             Assert.Throws<ArgumentNullException>(() => new Course("Math", 5, DateTime.Parse(value), DateTime.Now));
  37.         }
  38.  
  39.         [TestCase("February 01, 2017")]
  40.         [TestCase("2017/02/26")]
  41.         [TestCase("2017/02/01 18:37:58")]
  42.         [TestCase("2017 - 02 - 10")]
  43.         public void StartingDate_ShouldNotThrow_WhenPassedValueIsValid(string value)
  44.         {
  45.             Assert.DoesNotThrow(() => new Course("Math", 5, DateTime.Parse(value), DateTime.Now));
  46.         }
  47.  
  48.         [TestCase("February 01, 2017")]
  49.         [TestCase("2017/02/26")]
  50.         [TestCase("2017/02/01 18:37:58")]
  51.         [TestCase("2017 - 02 - 10")]
  52.         public void StartingDate_ShouldCorrectlyAssignPassedValue(string value)
  53.         {
  54.             //Arrange
  55.             ICourse course = new Course("Math", 5, DateTime.Parse(value), DateTime.Now);
  56.  
  57.             //Act and Assert
  58.             Assert.AreEqual(DateTime.Parse(value), course.StartingDate);
  59.         }
  60.     }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment