public Task Linq() { var l = from i in Enumerable.Range(1, 10) where i > 5 select i * i; // Runtime type of a linq expression is some derived Linq type which we can't deserialize to. // So explicitly call out IEnumerable<T> return(SerializerConsistencyHepers.TestAsync(l, typeof(IEnumerable <int>))); }
public Task NullEmptyWhitespaceString() { NormalClass source = new NormalClass { FirstName = string.Empty, LastName = null, Item = " " }; return(SerializerConsistencyHepers.TestAsync(source)); }
public Task NormalClass() { var source = new NormalClass { FirstName = "John", LastName = "Smith", Item = "Socks" }; return(SerializerConsistencyHepers.TestAsync(source)); }
public Task PartialContract() { var c = new PartialDataContract { PropertyWithAttribute = "one", PropertyWithoutAttribute = "false" }; return(SerializerConsistencyHepers.TestAsync(c)); }
public Task Dictionary() { var dict = new Dictionary <string, int>(); dict["one"] = 1; dict["two"] = 2; return(SerializerConsistencyHepers.TestAsync(dict)); }
public Task PrivateProperty() { var source2 = new PrivateProperty { FirstName = "John", LastName = "Smith" }; source2.SetItem("shoes"); return(SerializerConsistencyHepers.TestAsync(source2)); }
public Task ClassWithFields() { var c1 = new ClassWithFields { Property = "prop" }; c1.SetField("field"); return(SerializerConsistencyHepers.TestAsync(c1)); }
public Task InheritedProperties() { // Will we pick up inherited properties from a base object? BaseClass source = new DerivedClass { Property = "base", DerivedProperty = "derived" }; source.SetField("private"); return(SerializerConsistencyHepers.TestAsync(source, typeof(DerivedClass))); }
public async Task ArrayInterfaces() { string[] array = new string[] { "First", "Second", "Last" }; await SerializerConsistencyHepers.TestAsync(array, typeof(IList <string>)); await SerializerConsistencyHepers.TestAsync(array, typeof(ICollection <string>)); await SerializerConsistencyHepers.TestAsync(array, typeof(IEnumerable <string>)); }
public Task StaticProps() { ClassWithStaticProperties source = new ClassWithStaticProperties(); return(SerializerConsistencyHepers.TestAsync(source)); }
public Task Array() { string[] array = new string[] { "First", "Second", "Last" }; return(SerializerConsistencyHepers.TestAsync(array)); }