示例#1
0
        public async Task Update_WhenAllOK_ExpectedResultTrueAreEqual()
        {
            //Arrange
            var DALStub = new MovieDALStub(_Seed);

            var input = new MovieModelDAL
            {
                ID         = 2,
                Title      = "MOVIE: the Movie",
                Genre      = "Comedy",
                Director   = "MySelf",
                ImdbRating = 9000,
                Plot       = "This is a movie",
                Rated      = "Insert age here...",
                Year       = 2018
            };

            var expectedResult = new List <MovieModelDAL>
            {
                _Seed[0], _Seed[2], input
            };

            //Act
            bool test1  = DALStub.Update(input);
            var  result = await DALStub.GetAll(false);

            //Assert
            Assert.IsTrue(test1);
            Assert.IsTrue(expectedResult.Count == result.Count);
            for (int i = 0; i < result.Count; i++)
            {
                Assert.AreEqual(expectedResult[i], result[i]);
            }
        }
示例#2
0
        public void Update_WhenMovieNotExists_ExpectedResultFalse()
        {
            //Arrange
            var DALStub = new MovieDALStub(_Seed);

            var input = new MovieModelDAL
            {
                ID         = 4,
                Title      = "MOVIE: the Movie",
                Genre      = "Comedy",
                Director   = "MySelf",
                ImdbRating = 9000,
                Plot       = "This is a movie",
                Rated      = "Insert age here...",
                Year       = 2018
            };

            //Act
            bool test = DALStub.Update(input);

            //Assert
            Assert.IsFalse(test);
        }