public async Task UpdateStateByKeySetName()
        {
            await WithUpdateableState(client, async state =>
            {
                var name   = TestingUtility.RandomString();
                var action = new SetNameUpdateAction
                {
                    Name = new LocalizedString {
                        { "en", name },
                    }
                };

                var updatedState = await client
                                   .ExecuteAsync(state.UpdateByKey(actions => actions.AddUpdate(action)));

                Assert.Equal(name, updatedState.Name["en"]);
                return(updatedState);
            });
        }
コード例 #2
0
        public async Task UpdateDiscountCodeSetName()
        {
            await WithUpdateableDiscountCode(client, async discountCode =>
            {
                var newName = new LocalizedString {
                    { "en", TestingUtility.RandomString() }
                };
                var updateActions = new List <UpdateAction <DiscountCode> >();
                var action        = new SetNameUpdateAction {
                    Name = newName
                };
                updateActions.Add(action);

                var updatedDiscountCode = await client
                                          .ExecuteAsync(new UpdateByIdCommand <DiscountCode>(discountCode, updateActions));

                Assert.Equal(newName["en"], updatedDiscountCode.Name["en"]);
                return(updatedDiscountCode);
            });
        }
コード例 #3
0
        public async Task UpdateStoreByIdSetName()
        {
            await WithUpdateableStore(client, async store =>
            {
                var newName = new LocalizedString {
                    { "en", TestingUtility.RandomString() }
                };
                var updateActions = new List <UpdateAction <Store> >();
                var action        = new SetNameUpdateAction
                {
                    Name = newName
                };
                updateActions.Add(action);

                var updatedStore = await client
                                   .ExecuteAsync(new UpdateByIdCommand <Store>(store,
                                                                               updateActions));

                Assert.Equal(newName, updatedStore.Name);
                return(updatedStore);
            });
        }