public void CanConvertVersion() { // Arrange var converter = new SemanticVersionJsonConverter(); // Act and assert Assert.True(converter.CanConvert(typeof(Version))); }
public void Deserializes(string version, Type type) { // Arrange using (var reader = new JsonTextReader(new StringReader("\"" + version + "\""))) { var converter = new SemanticVersionJsonConverter(); // Act var result = converter.ReadJson(reader, type, null, new JsonSerializer()); // Assert Assert.Equal(version, result.ToString()); } }
public void SerializesVersionAsString(string version) { // Arrange var json = new StringBuilder(); using (var writer = new JsonTextWriter(new StringWriter(json))) { var converter = new SemanticVersionJsonConverter(); // Act converter.WriteJson(writer, Version.Parse(version), new JsonSerializer()); // Assert Assert.Equal("\"" + version + "\"", json.ToString()); } }