private ParseTestResult <RepositoryDescription> FromJson(string json, Uri documentRoot, bool expectWarnings = false)
            {
                var sink   = new CapturingTraceSink();
                var result = RepositoryDescription.FromJson(
                    JObject.Parse(json),
                    new TraceContext("test", sink),
                    documentRoot);
                var ret = new ParseTestResult <RepositoryDescription>(sink.Events, result);

                if (!expectWarnings)
                {
                    Assert.Empty(ret.GetEventsByMethod("JsonParseWarning"));
                }
                return(ret);
            }
 public void GivenANullTracer_ItThrows()
 {
     Assert.Throws <ArgumentNullException>("trace", () => RepositoryDescription.FromJson(new JObject(), null, new Uri("http://api.nuget.org")));
 }
 public void GivenANullJObject_ItThrows()
 {
     Assert.Throws <ArgumentNullException>("json", () => RepositoryDescription.FromJson(null, new TraceContext("foo", TraceSinks.Null), new Uri("http://api.nuget.org")));
 }