public void ParseGuid() { var parser = new GuidParser(); var input = "05da4492-054d-48f9-8b0e-a0e90c2aee4b"; var inputWithoutDash = "05da4492054d48f98b0ea0e90c2aee4b"; var expected = Guid.Parse(input); Assert.AreEqual(parser.Parse(input), expected); Assert.AreEqual(parser.Parse(inputWithoutDash), expected); }
public Guid(string g) { CheckNull(g); g = g.Trim(); GuidParser p = new GuidParser(g); Guid guid = p.Parse(); this = guid; }
public void ThrowsParsingExceptionOnBadInput() { var parser = new GuidParser(); var input = "notactuallyaguid"; var ex = Assert.Throws <ParsingException>(() => parser.Parse(input)); Assert.That(ex.Input, Is.EqualTo(input)); Assert.That(ex.TargetType, Is.EqualTo(typeof(Guid))); }
public static bool TryParse(string input, out Guid result) { if (input == null) { throw new ArgumentNullException("input"); } var parser = new GuidParser(input); return(parser.Parse(out result)); }
public static bool TryParseExact(string input, string format, out Guid result) { if (input == null || format == null) { result = Empty; return(false); } var parser = new GuidParser(input); return(parser.Parse(ParseFormat(format), out result)); }
public static bool TryParse(string input, out Guid result) { if (input == null) { result = Empty; return(false); } var parser = new GuidParser(input); return(parser.Parse(out result)); }
public Guid(string g) { CheckNull(g); g = g.Trim(); var parser = new GuidParser(g); Guid guid; if (!parser.Parse(out guid)) { throw CreateFormatException(g); } this = guid; }
public static bool TryParseExact(string input, string format, out Guid result) { if (input == null) { throw new ArgumentNullException("input"); } if (format == null) { throw new ArgumentNullException("format"); } var parser = new GuidParser(input); return(parser.Parse(ParseFormat(format), out result)); }
public Guid(string g) { CheckNull(g); g = g.Trim(); var parser = new GuidParser(g); Guid guid; if (!parser.Parse(out guid)) { throw CreateFormatException(g); } _a = guid._a; _b = guid._b; _c = guid._c; _d = guid._d; _e = guid._e; _f = guid._f; _g = guid._g; _h = guid._h; _i = guid._i; _j = guid._j; _k = guid._k; }
public static Either <TLeft, Guid> ParseToGuid <TLeft>(this string source, TLeft left) { return(GuidParser.Parse(source, left)); }
public static Either <TLeft, Guid> ParseToGuid <TLeft>(this Either <TLeft, string> source, TLeft left) { return(source.FlatMap(x => GuidParser.Parse(x, left))); }
public static Maybe <Guid> ParseToGuid(this string source) { return(GuidParser.Parse(source)); }