public void ValidateImageBinaryContentNoMatch() { using (Stream stream = new FileStream(noMatchImageContent, FileMode.Open, FileAccess.Read)) { IPDNAService pdnaService = new PDNAService(this.pdnaServiceOptions); ImageModeratableContent imageContent = new ImageModeratableContent(new BinaryContent(stream, "image/jpeg")); var moderateResult = pdnaService.ValidateImageAsync(imageContent, false); var actualResult = moderateResult.Result; Assert.IsTrue(actualResult != null, "Expected valid result, Response: {0}", JsonConvert.SerializeObject(actualResult)); Assert.IsTrue(actualResult.MatchDetails.MatchFlags.Count() == 0, "No Match was expected for this image, Response: {0}", JsonConvert.SerializeObject(actualResult)); } }
public void ValidateImageInCache() { IPDNAService pdnaService = new PDNAService(this.pdnaServiceOptions); var actualResult = ValidateImageContent(pdnaService, true); Assert.IsTrue(actualResult != null, "Expected valid result"); Assert.IsTrue(actualResult.IsMatch, "Expected valid result"); Assert.IsNotNull(actualResult.CacheID, "Cache ID should not be null"); var pdnaResult = pdnaService.ValidateImageInCache(actualResult.CacheID); var matchRes = pdnaResult.Result; Assert.IsTrue(matchRes != null, "Expected valid result"); Assert.IsTrue(matchRes.IsMatch, "Expected valid result"); Assert.IsNotNull(matchRes.MatchDetails, "Expected valid result"); }
public void ValidateImageUrl() { IPDNAService pdnaService = new PDNAService(this.pdnaServiceOptions); Service.Results.MatchImageResult extractResult = ValidateImageContent(pdnaService, false); Assert.IsTrue(extractResult != null, "Expected valid result"); Assert.IsTrue(extractResult.IsMatch, "Expected valid result"); Assert.IsNotNull(extractResult.MatchDetails, "Expected valid result"); }