public async Task ShouldReturnValuesAsync() { // When await AsyncApiClient .GetValuesAsync(); // Then Assert.NotEmpty((IEnumerable <string>)ApiClient.CurrentState); Fixture.MockLogger.VerifyNoErrorsWasLogged(); }
public async Task ShouldValidatePositiveKeysAsync() { // Given const int id = 1; const string expectedValue = "test"; // When await AsyncApiClient .PostValueAsync(id, expectedValue); // Then Assert.Equal(id, ((ApiResponse <int>)ApiClient.CurrentState).Data); Fixture.MockLogger.VerifyNoErrorsWasLogged(); }
public async Task ShouldSetValueAsync() { // Given const int id = 1; const string expectedValue = "test"; // When await AsyncApiClient .SetValueAsync(id, expectedValue) .GetValueAsync(id); // Then Assert.Equal(expectedValue, (string)ApiClient.CurrentState); Fixture.MockLogger.VerifyNoErrorsWasLogged(); }
public async Task ShouldDeleteValueAsync() { // Given const int id = 2; // When await AsyncApiClient .SetValueAsync(id, "test") .DeleteValueAsync(id); // When, Then await Assert.ThrowsAsync <ApiException>(async() => await AsyncApiClient.GetValueAsync(id)); Fixture.MockLogger.VerifyErrorWasLogged <KeyNotFoundException>(); }
public async Task ShouldSetValueAsync() { // Given const int id = 1; const string expectedValue = "test"; // When await AsyncApiClient .SetValueAsync(new ValuesModificationRequest { Values = new[] { new ConfigurationValue { Id = id, Value = expectedValue } } }) .GetValueAsync(id); // Then Assert.Equal(expectedValue, (string)ApiClient.CurrentState); Fixture.MockLogger.VerifyNoErrorsWasLogged(); }
public async Task ShouldDeleteValueAsync() { // Given const int id = 2; // When await AsyncApiClient .SetValueAsync(new ValuesModificationRequest { Values = new[] { new ConfigurationValue { Id = id, Value = "test" } } }) .DeleteValueAsync(id); // When, Then await Assert.ThrowsAsync <ApiException>(async() => await AsyncApiClient.GetValueAsync(id)); Fixture.MockLogger.VerifyErrorWasLogged <KeyNotFoundException>(); }