public void Detect_WhenCalled_RequestMethodShouldBePost() { _content = new byte[] { }; _helper.Setup(hlpr => hlpr.CreateByteArrayContent("a", "b")) .Returns(new ByteArrayContent(_content)); _api = new FaceAPIs(_helper.Object); var result = _api.Detect("a"); _messageHandler .Protected() .Verify( "SendAsync", Times.Exactly(TimesCalled), ItExpr.Is <HttpRequestMessage>(req => req.Method == HttpMethod.Post), ItExpr.IsAny <CancellationToken>()); }
public void Detect_WhenCalled_RequestUriMustBeEqualToExpectedUri() { _uri = new Uri(APISettings.UriBase + $"detect?returnFaceId=true"); _content = new byte[] { }; _helper.Setup(hlpr => hlpr.CreateByteArrayContent("a", "b")) .Returns(new ByteArrayContent(_content)); _api = new FaceAPIs(_helper.Object); var result = _api.Detect("a"); _messageHandler .Protected() .Verify( "SendAsync", Times.Exactly(TimesCalled), ItExpr.Is <HttpRequestMessage>(req => req.RequestUri == _uri), ItExpr.IsAny <CancellationToken>()); }