public void ConfirmValidId()

        {
            // act

            RedirectToRouteResult value = controller.DeleteConfirmed(700) as RedirectToRouteResult;

            var valuelist = value.RouteValues.ToArray();

            // assert

            Assert.AreEqual("Index", valuelist[0].Value);
        }
Beispiel #2
0
        public void Subjects_Controller_Test_On_Delete_Confirmed_With_Existent_Id()
        {
            //Arrange
            Guid   id          = new Guid("f616cc8c-2223-4145-b7d0-232a1f6f0795");
            string title       = "TestT";
            int    noOfCredits = 10;

            Subject expectedSubject = new Subject(title, noOfCredits);

            expectedSubject.Id = id;

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

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

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