public void ValidateImageForUpload_ImageIsContentTypeImagePng_AndSize1_ReturnTrue() { // Given String contentType = "image/png"; AdImageServices service = new AdImageServices(null, null); // Then Assert.IsTrue(service.ValidateImageForUpload(contentType, 1)); }
public void StoreImage_SavesImageInDbAndReturnCreatedIdentifier() { // Given DateTime d = new DateTime(2012, 01, 17); Guid guidId = new Guid("14a5e994-fd5d-4a32-859d-a152013ad860"); var repoMock = new Moq.Mock<IRepository>(); repoMock.Setup(x => x.Save<AdImage>(Moq.It.IsAny<AdImage>())); var helperMock = new Moq.Mock<IHelperService>(); helperMock.Setup(x => x.GetCurrentDateTime()).Returns(d); AdImageServices service = new AdImageServices(repoMock.Object, helperMock.Object); // Then AdImage actual = service.StoreImage(guidId, true); Assert.AreEqual(guidId, actual.Id); Assert.IsTrue(actual.IsPrimary); Assert.AreEqual(d, actual.UploadedDate); }
public void ValidateImageForUpload_ImageIsContentTypeNot_AndSize1_ReturnFalse() { // Given String contentType = "appliction/json"; AdImageServices service = new AdImageServices(null, null); // Then Assert.IsFalse(service.ValidateImageForUpload(contentType, 1)); }
public void ValidateImageForUpload_ImageIsContentTypeImagePng_AndSizeTooBig_ReturnFalse() { // Given String contentType = "image/png"; AdImageServices service = new AdImageServices(null, null); // Then Assert.IsFalse(service.ValidateImageForUpload(contentType, 5048577)); }