Exemple #1
0
 public void ShouldReturnValues()
 {
     Assert.NotEmpty(_defaultClient.Get());
     Fixture.MockLogger
     .VerifyNoErrorsWasLogged()
     .VerifyNoWarningsWasLogged();
 }
Exemple #2
0
        public void ShouldSetValueUsingProtobufFormatters()
        {
            // Given
            const int    id            = 1;
            const string expectedValue = "test";

            var client = new ValuesServiceClient(
                x => x.WithBaseUrl(Fixture.Server.BaseAddress.ToString())
                .WithTimeout(TimeSpan.FromMilliseconds(Fixture.TimeoutInMilliseconds))
                .WithHttpMessageHandler(Fixture.Server.CreateHandler())
                .WithSerializer(
                    new ProtobufSerializer(s => s.WithDefaultSettings())
                    )
                );

            // When
            client.Set(new ValuesModificationRequest {
                Values = new[] { new ConfigurationValue {
                                     Id = id, Value = expectedValue
                                 } }
            });
            var actualValue = client.Get(id);

            // Then
            Assert.Equal(expectedValue, actualValue);
            Fixture.MockLogger
            .VerifyNoErrorsWasLogged()
            .VerifyNoWarningsWasLogged();
        }
Exemple #3
0
        public void ShouldReturnBadRequestIfOperationWasCancelled()
        {
            // Given
            var client = new ValuesServiceClient(
                x => x.WithBaseUrl(Fixture.Server.BaseAddress.ToString())
                .WithTimeout(TimeSpan.FromMilliseconds(100))
                .WithHttpMessageHandler(Fixture.Server.CreateHandler())
                .WithSerializer(new JsonNetSerializer(new JsonSerializerSettings().UseDefaultSettings()))
                );

            Assert.Throws <BadRequestException>(() => client.Get());
            Fixture.MockLogger
            .VerifyNoErrorsWasLogged()
            .VerifyWarningWasLogged();
        }
 public ApiClient GetValues()
 {
     CurrentState = _valuesServiceClient.Get();
     return(this);
 }