public void EditCentreDetailsPost_removeLogo_removes_logo() { // Given const string action = "removeLogo"; var model = new EditCentreDetailsViewModel { BannerText = "Test banner text", CentreLogo = new byte[100], }; // When var result = controller.EditCentreDetails(model, action); // Then result.Should().BeViewResult(); var returnModel = (result as ViewResult) !.Model as EditCentreDetailsViewModel; returnModel !.CentreLogo.Should().BeNull(); }
public void EditCentreDetailsPost_previewLogo_calls_imageResizeService() { // Given const string action = "previewLogo"; var model = new EditCentreDetailsViewModel { BannerText = "Test banner text", CentreLogo = new byte[100], CentreLogoFile = A.Fake <IFormFile>(), }; var newImage = new byte [200]; A.CallTo(() => imageResizeService.ResizeCentreImage(A <IFormFile> ._)).Returns(newImage); // When var result = controller.EditCentreDetails(model, action); // Then result.Should().BeViewResult(); A.CallTo(() => imageResizeService.ResizeCentreImage(A <IFormFile> ._)).MustHaveHappenedOnceExactly(); var returnModel = (result as ViewResult) !.Model as EditCentreDetailsViewModel; returnModel !.CentreLogo.Should().BeEquivalentTo(newImage); }