public void Set_Primitive_Uri_Success() { TypeAdapter.ClearCache(); TypeAdapterConfig.GlobalSettings.PrimitiveTypes.Add(typeof(Uri)); var sourceUri = new Uri("http://example.com"); var targetUri = TypeAdapter.Adapt <Uri, Uri>(sourceUri); targetUri.ShouldEqual(sourceUri); }
public void No_Primitive_Uri_Should_Throw() { TypeAdapter.ClearCache(); var sourceUri = new Uri("http://example.com"); var exception = Assert.Throws <ArgumentNullException>(() => TypeAdapter.Adapt <Uri, Uri>(sourceUri)); Console.WriteLine(exception.Message); exception.ParamName.ShouldEqual("con"); }