public void UpdateTypeByIdChangeKey() { IClient commerceToolsClient = this.typeFixture.GetService <IClient>(); Type type = this.typeFixture.CreateType(); List <UpdateAction <Type> > updateActions = new List <UpdateAction <Type> >(); string newKey = TestingUtility.RandomString(10); ChangeKeyUpdateAction changeKeyUpdateAction = new ChangeKeyUpdateAction() { Key = newKey }; updateActions.Add(changeKeyUpdateAction); Type retrievedType = commerceToolsClient.ExecuteAsync(new UpdateByIdCommand <Type>(new Guid(type.Id), type.Version, updateActions)).Result; this.typeFixture.TypesToDelete.Add(retrievedType); Assert.Equal(newKey, retrievedType.Key); }
public async Task UpdateTypeChangeKey() { var newKey = $"UpdateTypeChangeKey-{TestingUtility.RandomString()}"; await WithUpdateableType(client, async type => { var updateActions = new List <UpdateAction <Type> >(); var changeKeyAction = new ChangeKeyUpdateAction { Key = newKey }; updateActions.Add(changeKeyAction); var updatedType = await client .ExecuteAsync(new UpdateByIdCommand <Type>(type, updateActions)); Assert.Equal(newKey, updatedType.Key); return(updatedType); }); }