Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Academy.Tests.ModelsTest.CourseTest
- {
- [TestFixture]
- public class LecturesPerWeekTest
- {
- [TestCase(0)]
- [TestCase(-1)]
- [TestCase(-15)]
- [TestCase(8)]
- [TestCase(12)]
- public void LecturesPerWeek_ShouldThrowArgumentException_WhenPassedValueIsInvalid(int value)
- {
- Assert.Throws<ArgumentException>(() => new Course("Math", value, DateTime.Today, DateTime.Now));
- }
- [TestCase(1)]
- [TestCase(2)]
- [TestCase(3)]
- [TestCase(6)]
- [TestCase(7)]
- public void LecturesPerWeek_ShouldNotThrowException_WhenPassedValueIsValid(int value)
- {
- Assert.DoesNotThrow(() => new Course("Math", value, DateTime.Today, DateTime.Now));
- }
- }
- }
- namespace Academy.Tests.ModelsTest.CourseTest
- {
- [TestFixture]
- public class StartingDateTest
- {
- [TestCase(null)]
- public void StartingDate_ShouldThrowArgumentNullException_WhenPassedValueIsInvalid(string value)
- {
- Assert.Throws<ArgumentNullException>(() => new Course("Math", 5, DateTime.Parse(value), DateTime.Now));
- }
- [TestCase("February 01, 2017")]
- [TestCase("2017/02/26")]
- [TestCase("2017/02/01 18:37:58")]
- [TestCase("2017 - 02 - 10")]
- public void StartingDate_ShouldNotThrow_WhenPassedValueIsValid(string value)
- {
- Assert.DoesNotThrow(() => new Course("Math", 5, DateTime.Parse(value), DateTime.Now));
- }
- [TestCase("February 01, 2017")]
- [TestCase("2017/02/26")]
- [TestCase("2017/02/01 18:37:58")]
- [TestCase("2017 - 02 - 10")]
- public void StartingDate_ShouldCorrectlyAssignPassedValue(string value)
- {
- //Arrange
- ICourse course = new Course("Math", 5, DateTime.Parse(value), DateTime.Now);
- //Act and Assert
- Assert.AreEqual(DateTime.Parse(value), course.StartingDate);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment