コード例 #1
0
        public void TestCreateNewActor_DuplicateName()
        {
            Actor actor = new Actor
            {
                ActorID = 5,
                ActorName = "Anjum",
                ActorDescription = "TestDescription",

                 ActorReviews = null
            };

            ActorsController actorController = new ActorsController();

            // Act
            ViewResult result = actorController.Create(actor.ActorID, actor.ActorName, actor.ActorDescription, actor) as ViewResult;

            // Assert
            Assert.AreEqual("Duplicate Name", result.ViewBag.Message);
        }
コード例 #2
0
        public void TestCreateNewActor_DescriptionToShort()
        {
            Actor actor = new Actor
            {
                ActorID = 10,
                ActorName = "TestFilm",
                ActorDescription = "",

               ActorReviews = null
            };

            ActorsController actorController = new ActorsController();

            // Act
            ViewResult result = actorController.Create(actor) as ViewResult;

            // Assert
            Assert.AreEqual("Invalid Length", result.ViewBag.Message);
        }
コード例 #3
0
        public void TestCreateNewActor_NullValue()
        {
            Actor actor = new Actor
            {
                ActorID = 10,
                ActorName = null,
                ActorDescription = "Test Description",

                ActorReviews = null
            };

            ActorsController actorsController = new ActorsController();

            // Act
            ViewResult result = actorsController.Create(actor) as ViewResult;

            // Assert
            Assert.AreEqual("Null Value", result.ViewBag.Message);
        }