public Type Test(TSource source) { // retrieve source property getter var objSource = (object)source; var sourceType = objSource.GetType(); Assert.AssertEquals(typeof(TSource), sourceType); return(sourceType); }
public void Test(TSource source) { // retrieve source property getter var sourceType = source.GetType(); Func <object, object> g = obj => obj.ToString(); Func <object> getSourceValue = () => g(source); if (sourceType != typeof(TSource)) { Assert.Fail(); } }
public void TestContrainedOnGenericField() { var a = new Test2 <DateTime>(DateTime.UtcNow); Assert.AssertEquals(typeof(DateTime), a.element.GetType()); }