예제 #1
0
        public void Exams_Controller_Test_On_Delete_Confirmed_With_Existent_Id()
        {
            //Arrange
            Guid     id           = new Guid("f616cc8c-2223-4145-b7d0-232a1f6f0795");
            string   title        = "TestT";
            string   observations = "TestF";
            DateTime dateStart    = DateTime.Now;
            DateTime dateEnd      = DateTime.Now.AddDays(1);

            Exam expectedExams = new Exam(title, observations, dateStart, dateEnd);

            expectedExams.Id = id;

            var repo = Substitute.For <IRepository>();
            var sut  = new ExamsController(repo);

            repo.GetById <Exam>(id).Returns(expectedExams);
            //Act
            var actual = sut.DeleteConfirmed(id).Result;

            //Assert
            Assert.IsInstanceOfType(actual, typeof(RedirectToActionResult));
        }