public void CreatePicture_Should_Return_Null_If_Dto_Is_Null() { //Arrange var mock = new Mock <IPictureRepository>(); var myPicture = new PictureDTO { Id = 1, IsProfilePicture = true, Resto = new RestoDTO(), Url = "www.myurl.com" }; mock.Setup(x => x.Create(myPicture)).Returns( new PictureDTO { Id = 1, IsProfilePicture = true, Resto = new RestoDTO(), Url = "www.myurl.com" } ); PictureUC target = new PictureUC(mock.Object); //Act var result = target.AddPicture(null); //Assert Assert.IsNull(result); }
public void UpdatePicture_Should_Return_Valid_Data() { //Arrange var mock = new Mock <IPictureRepository>(); var myPicture = new PictureDTO { Id = 1, IsProfilePicture = true, Resto = new RestoDTO(), Url = "www.myurl.com" }; mock.Setup(x => x.Update(myPicture)).Returns( new PictureDTO { Id = 1, IsProfilePicture = false, Resto = new RestoDTO(), Url = "www.myurl.com" } ); PictureUC target = new PictureUC(mock.Object); //Act var result = target.UpdatePicture(new PictureBTO { Id = 1, IsProfilePicture = false, Resto = new RestoBTO(), Url = "www.myurl.com" }); //Assert mock.Verify(u => u.Update(It.IsAny <PictureDTO>()), Times.Once()); }
public void UpdatePicture_Should_Return_Null_If_No_Result_Found_In_Db() { //Arrange var mock = new Mock <IPictureRepository>(); var myPicture = new PictureDTO { Id = 1, IsProfilePicture = true, Resto = new RestoDTO(), Url = "www.myurl.com" }; mock.Setup(x => x.Update(myPicture)); PictureUC target = new PictureUC(mock.Object); //Act var result = target.UpdatePicture(new PictureBTO { Id = 1, IsProfilePicture = true, Resto = new RestoBTO(), Url = "www.myurl.com" }); //Assert Assert.IsNull(result); }
public RestaurantController(IRestoRepository RestoRepository, ICuisineRepository CuisineRepository, IPictureRepository PictureRepository) { restoRepository = RestoRepository; cuisineRepository = CuisineRepository; pictureRepository = PictureRepository; cuisineUC = new CuisineUC(cuisineRepository); pictureUC = new PictureUC(pictureRepository); }
public PictureController(IPictureRepository PictureRepository) { pictureRepository = PictureRepository; pictureUC = new PictureUC(pictureRepository); }