示例#1
0
        public async Task UpdateAddressActionClientTest()
        {
            await ResetDatasource();

            Uri serviceUrl = new Uri(string.Format(this.BaseAddress + "/AttributeRouting/"));
            var client = new TypedProxy.Container(serviceUrl);
            client.MergeOption = MergeOption.OverwriteChanges;

            TypedProxy.Address address = new TypedProxy.Address()
            {
                City = "New City",
                Street = "New Street",
                Country = "New Country"
            };
            client.UpdateAddressAction(address, 1).GetValue();

            var account = client.Accounts.Where(a => a.Id == 1).Single();
            Assert.Equal("New City", account.Address.City);
            Assert.Equal("New Country", account.Address.Country);
        }
示例#2
0
        public async Task AddShipAddressActionClientTest()
        {
            foreach (string routing in Routings)
            {
                await ResetDatasource();

                Uri serviceUrl = new Uri(string.Format(this.BaseAddress + "/{0}/", routing));
                var client = new TypedProxy.Container(serviceUrl);
                client.MergeOption = MergeOption.OverwriteChanges;

                client.Format.UseJson();

                TypedProxy.Address shipAddress = new TypedProxy.Address()
                {
                    City = "Hang zhou",
                    Street = "Anything",
                };
                int shipAddressCount = client.Accounts.Where(a => a.Id == 1).Single().AddShipAddress(shipAddress).GetValue();

                Assert.Equal(3, shipAddressCount);
                shipAddressCount = client.Accounts.Where(a => a.Id == 1).Single().AddShipAddress(shipAddress).GetValue();

                Assert.Equal(4, shipAddressCount);
            }
        }