public void RoundTripLowerNoDash(string shortString, string longString) { Guid guid = new Guid(longString); Assert.AreEqual(shortString, guid.ToLowerNoDashString()); Assert.AreEqual(guid, GuidUtility.FromLowerNoDashString(shortString)); }
protected override Guid ReadCore(JsonReader reader, JsonSerializer serializer) { if (reader.TokenType != JsonToken.String) { throw new JsonSerializationException("Expected string for Guid; got " + reader.TokenType); } try { return(GuidUtility.FromLowerNoDashString((string)reader.Value)); } catch (FormatException x) { throw new JsonSerializationException("Error deserializing GUID.", x); } }
public void FromLowerNoDashFailure(string lowerNoDashString) { Assert.Throws <FormatException>(() => GuidUtility.FromLowerNoDashString(lowerNoDashString)); }