public void CanConvertWorksForSingleResult(Type type, bool expected) { // Arrange JSingleResultValueConverter converter = new JSingleResultValueConverter(); // Act & Assert Assert.Equal(expected, converter.CanConvert(type)); }
public void CanWriteSingleResultToJsonUsingNewtonsoftJsonConverter() { // Arrange SingleResult <SingleCustomer> pageResult = new SingleResult <SingleCustomer>(_customers); JSingleResultValueConverter converter = new JSingleResultValueConverter(); // Act string json = SerializeUtils.WriteJson(converter, pageResult); // Assert Assert.Equal("{\"Id\":1,\"Name\":\"XU\"}", json); }
public void ReadJsonForSingleResultThrowsNotImplementedException() { // Arrange JSingleResultValueConverter converter = new JSingleResultValueConverter(); // Act Action test = () => converter.ReadJson(null, typeof(object), null, null); // Assert NotImplementedException exception = Assert.Throws <NotImplementedException>(test); Assert.Equal(SRResources.ReadSingleResultNotImplemented, exception.Message); }