示例#1
0
        public void TestControllerCreateReturnsCorrectView()
        {
            var controller   = new TestsController(mockContext.Object);
            var CreateResult = controller.Create() as ViewResult;

            //Assert
            Assert.AreEqual("Create", CreateResult.ViewName);
        }
示例#2
0
        public void Create_WithValidApplicant_ShouldCallService()
        {
            //Arrange
            var model = new InterviewerTestBindingModel();

            bool serviceCalled = false;

            var mockRepository = new Mock <IInterviewerTestsService>();

            mockRepository.Setup(r => r.Create(model))
            .Callback(() => serviceCalled = true);

            var controller = new TestsController(mockRepository.Object);

            //Act
            var result = controller.Create(model);

            //Assert
            Assert.IsTrue(serviceCalled);
        }