public async Task Delete_WhenOneMovieExists_ExpectedResultCount0() { //Arrange var input = new MovieModelDAL { ID = 1, Title = "MOVIE: the Movie", Genre = "Comedy", Director = "MySelf", ImdbRating = 9000, Plot = "This is a movie", Rated = "Insert age here...", Year = 2018 }; var initialMovies = new List <MovieModelDAL> { input }; var DALStub = new MovieDALStub(initialMovies); //Act bool test1 = DALStub.Delete(1); var result = await DALStub.GetAll(false); //Assert Assert.IsTrue(test1); Assert.IsTrue(result.Count == 0); }
public async Task Create_WhenOtherMoviesExist_ExpectedResultTrueAreEqual() { //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 }; var expectedResult = new List <MovieModelDAL>(_Seed); expectedResult.Add(input); //Act bool test1 = DALStub.Create(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].ID, result[i].ID); Assert.AreEqual(expectedResult[i].Title, result[i].Title); } }
public void Get_WhenTargetNotExists_ExpectedResultNull() { //Arrange var DALStub = new MovieDALStub(_Seed); //Act var result = DALStub.Get(4); //Assert Assert.IsNull(result); }
public void Delete_WhenTargetNotExists_ExpectedResultFalse() { //Arrange var DALStub = new MovieDALStub(_Seed); //Act bool test = DALStub.Delete(4); //Assert Assert.IsFalse(test); }
public void Get_WhenAllOK_ExpectedResultAreEqual() { //Arrange var DALStub = new MovieDALStub(_Seed); var expectedResult = _Seed[1]; //Act var result = DALStub.Get(2); //Assert Assert.AreEqual(expectedResult, result); }
public async Task GetAll_WhenAllOK_ExpectedResultAreEqual() { //Arrange var DALStub = new MovieDALStub(_Seed); var expectedResult = _Seed; //Act var result = await DALStub.GetAll(false); //Assert Assert.IsTrue(expectedResult.Count == result.Count); for (var i = 0; i < result.Count; i++) { Assert.AreEqual(expectedResult[i], result[i]); } }
public async Task Delete_WhenThreeMoviesExists_ExpectedResultCount2() { //Arrange var DALStub = new MovieDALStub(_Seed); var expectedResult = new List <MovieModelDAL> { _Seed[0], _Seed[2] }; //Act bool test1 = DALStub.Delete(2); var result = await DALStub.GetAll(false); //Assert Assert.IsTrue(test1); Assert.IsTrue(result.Count == 2); for (int i = 0; i < result.Count; i++) { Assert.AreEqual(expectedResult[i].ID, result[i].ID); Assert.AreEqual(expectedResult[i].Title, result[i].Title); } }
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); }
public void Create_WhenNoExistingMovies_ExpectedResultTrueAreEqual() { //Arrange var DALStub = new MovieDALStub(); 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 test1 = DALStub.Create(input); var result = DALStub.Get(4); //Assert Assert.IsTrue(test1); Assert.AreEqual(input, result); }