Ejemplo n.º 1
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();
        }
Ejemplo n.º 2
0
        public void ShouldSetValue()
        {
            // Given
            const int    id            = 1;
            const string expectedValue = "test";

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

            // Then
            Assert.Equal(expectedValue, actualValue);
            Fixture.MockLogger
            .VerifyNoErrorsWasLogged()
            .VerifyNoWarningsWasLogged();
        }
 public ApiClient SetValue(int id, string value)
 {
     _valuesServiceClient.Set(id, value);
     return(this);
 }
 public ApiClient SetValue(ValuesModificationRequest request)
 {
     _valuesServiceClient.Set(request);
     return(this);
 }