public void Test_DoesNotThrowException_IfTestIsSuccessful() { // Arrange var key = "Name"; var dictionary = new Dictionary <string, object>(); dictionary[key] = "James"; var dictionaryAdapter = new DictionaryAdapter <string, object>(); var resolver = new DefaultContractResolver(); // Act var testStatus = dictionaryAdapter.TryTest(dictionary, key, resolver, "James", out var message); //Assert Assert.True(testStatus); Assert.True(string.IsNullOrEmpty(message), "Expected no error message"); }
public void Test_ThrowsJsonPatchException_IfTestFails() { // Arrange var key = "Name"; var dictionary = new Dictionary <string, object>(); dictionary[key] = "James"; var dictionaryAdapter = new DictionaryAdapter <string, object>(); var resolver = new DefaultContractResolver(); var expectedErrorMessage = "The current value 'James' at path 'Name' is not equal to the test value 'John'."; // Act var testStatus = dictionaryAdapter.TryTest(dictionary, key, resolver, "John", out var errorMessage); //Assert Assert.False(testStatus); Assert.Equal(expectedErrorMessage, errorMessage); }