Пример #1
0
        public async Task PostCommentsWithDataContract()
        {
            MobileServiceClient client = GetClient();
            IMobileServiceTable <DataContractBlogPost> postTable = client.GetTable <DataContractBlogPost>();

            // Add a few posts and a comment
            Log("Adding posts");
            DataContractBlogPost post = new DataContractBlogPost()
            {
                Title = "How DataContracts Work"
            };
            await postTable.InsertAsync(post);

            DataContractBlogPost highlight = new DataContractBlogPost {
                Title = "Using the 'DataMember' attribute"
            };
            await postTable.InsertAsync(highlight);

            Assert.AreEqual(2, (await postTable.Where(p => p.Id >= post.Id).ToListAsync()).Count);
        }
Пример #2
0
        public async Task PostCommentsWithDataContract()
        {
            MobileServiceClient client = GetClient();
            IMobileServiceTable<DataContractBlogPost> postTable = client.GetTable<DataContractBlogPost>();

            // Add a few posts and a comment
            Log("Adding posts");
            DataContractBlogPost post = new DataContractBlogPost() { Title = "How DataContracts Work" };
            await postTable.InsertAsync(post);
            DataContractBlogPost highlight = new DataContractBlogPost { Title = "Using the 'DataMember' attribute" };
            await postTable.InsertAsync(highlight);

            Assert.AreEqual(2, (await postTable.Where(p => p.Id >= post.Id).ToListAsync()).Count);
        }