Exemplo n.º 1
0
        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));
        }
Exemplo n.º 5
0
        public Task Dictionary()
        {
            var dict = new Dictionary <string, int>();

            dict["one"] = 1;
            dict["two"] = 2;

            return(SerializerConsistencyHepers.TestAsync(dict));
        }
Exemplo n.º 6
0
        public Task PrivateProperty()
        {
            var source2 = new PrivateProperty {
                FirstName = "John", LastName = "Smith"
            };

            source2.SetItem("shoes");
            return(SerializerConsistencyHepers.TestAsync(source2));
        }
Exemplo n.º 7
0
        public Task ClassWithFields()
        {
            var c1 = new ClassWithFields {
                Property = "prop"
            };

            c1.SetField("field");
            return(SerializerConsistencyHepers.TestAsync(c1));
        }
Exemplo n.º 8
0
        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)));
        }
Exemplo n.º 9
0
        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>));
        }
Exemplo n.º 10
0
        public Task StaticProps()
        {
            ClassWithStaticProperties source = new ClassWithStaticProperties();

            return(SerializerConsistencyHepers.TestAsync(source));
        }
Exemplo n.º 11
0
        public Task Array()
        {
            string[] array = new string[] { "First", "Second", "Last" };

            return(SerializerConsistencyHepers.TestAsync(array));
        }