コード例 #1
0
        public void Train_WhenCalled_ReturnHttpStatusCodeOfAccepted()
        {
            var result = _api.Train(ParameterConstants.PersonGroupId)
                         .Result;

            Assert.That(result.StatusCode, Is.EqualTo(HttpStatusCode.Accepted));
        }
コード例 #2
0
        public void Train_WhenCalled_RequestMethodShouldBePost()
        {
            _api = new PersonGroupAPIs(_helper.Object);

            var result = _api.Train("a");

            _messageHandler
            .Protected()
            .Verify(
                "SendAsync",
                Times.Exactly(TimesCalled),
                ItExpr.Is <HttpRequestMessage>(req => req.Method == HttpMethod.Post),
                ItExpr.IsAny <CancellationToken>());
        }
コード例 #3
0
        public void Train_WhenCalled_RequestUriMustBeEqualToExpectedUri()
        {
            _uri = new Uri(APISettings.UriBase + "persongroups/a/train");
            _api = new PersonGroupAPIs(_helper.Object);

            var result = _api.Train("a");

            _messageHandler
            .Protected()
            .Verify(
                "SendAsync",
                Times.Exactly(TimesCalled),
                ItExpr.Is <HttpRequestMessage>(req => req.RequestUri == _uri),
                ItExpr.IsAny <CancellationToken>());
        }