public void AddImageWithImvalidParametersShouldThrowAnAxception() { var mapper = this.GetMapper(); var realEstateServices = new Mock <IRealEstateServices>(); var imageServices = new ImageServices(context, mapper, realEstateServices.Object); string invalidPublicKey = null; string url = @"https://res.cloudinary.com/home-hunter-cloud/image/upload/v1566894195/RealEstates/087f784b-a79a-42ae-8782-58958345edaa.jpg"; string realEstateId = "myniqueRealEstateId1"; int sequence = 1; Assert.ThrowsAsync <ArgumentNullException>(() => imageServices.AddImageAsync(invalidPublicKey, url, realEstateId, sequence), ExceptionMessage); }
public async Task AddImageToTheDbShouldReturnTrue() { var mapper = this.GetMapper(); var realEstateServices = new Mock <IRealEstateServices>(); var imageServices = new ImageServices(context, mapper, realEstateServices.Object); string publicKey = "myCoolPublicKey"; string url = @"https://res.cloudinary.com/home-hunter-cloud/image/upload/v1566894195/RealEstates/087f784b-a79a-42ae-8782-58958345edaa.jpg"; string realEstateId = "myniqueRealEstateId1"; int sequence = 1; var actualResult = await imageServices.AddImageAsync(publicKey, url, realEstateId, sequence); Assert.IsTrue(actualResult, ExpectedTrueResultMessage); }