Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [TestFixture]
- public class Execute_Should
- {
- [Test]
- public void ThrowArgumentException_WhenPassedCourseFormIsInvalid()
- {
- var engineMock = new Mock<IEngine>();
- var factoryMock = new Mock<IAcademyFactory>();
- var studentMock = new Mock<IStudent>();
- var seasonMock = new Mock<ISeason>();
- var courseMock = new Mock<ICourse>();
- studentMock.SetupGet(x => x.Username).Returns("Pesho");
- engineMock.SetupGet(x => x.Students).Returns(new List<IStudent>() { studentMock.Object });
- seasonMock.SetupGet(x => x.Students).Returns(new List<IStudent>() { studentMock.Object });
- engineMock.SetupGet(x => x.Seasons).Returns(new List<ISeason>() { seasonMock.Object });
- courseMock.SetupGet(x => x.OnlineStudents).Returns(new List<IStudent>() { studentMock.Object });
- seasonMock.SetupGet(x => x.Courses).Returns(new List<ICourse>() { courseMock.Object });
- var addStudentToCourse = new AddStudentToCourseCommand(factoryMock.Object, engineMock.Object);
- var parameters = new List<string>() { "Pesho", "0", "0", "no valid form" };
- //Act and Assert
- Assert.Throws<ArgumentException>(() => addStudentToCourse.Execute(parameters));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment