public async Task Models_Lifecycle() { DigitalTwinsClient client = GetClient(); string buildingModelId = await GetUniqueModelIdAsync(client, TestAssetDefaults.BuildingModelId).ConfigureAwait(false); string floorModelId = await GetUniqueModelIdAsync(client, TestAssetDefaults.FloorModelId).ConfigureAwait(false); string hvacModelId = await GetUniqueModelIdAsync(client, TestAssetDefaults.HvacModelId).ConfigureAwait(false); string wardModelId = await GetUniqueModelIdAsync(client, TestAssetDefaults.WardModelId).ConfigureAwait(false); try { string modelBuilding = TestAssetsHelper.GetBuildingModelPayload(buildingModelId, hvacModelId, floorModelId); string modelHvac = TestAssetsHelper.GetHvacModelPayload(hvacModelId, floorModelId); string modelWard = TestAssetsHelper.GetWardModelPayload(wardModelId); // CREATE models var modelsList = new List <string> { modelBuilding, modelHvac, modelWard }; await CreateAndListModelsAsync(client, modelsList).ConfigureAwait(false); // GET one created model Response <DigitalTwinsModelData> buildingModel = await client.GetModelAsync(buildingModelId).ConfigureAwait(false); Console.WriteLine($"Got {buildingModelId} as {buildingModel.Value.DtdlModel}"); // LIST all models AsyncPageable <DigitalTwinsModelData> models = client.GetModelsAsync(); await foreach (DigitalTwinsModelData model in models) { Console.WriteLine($"{model.Id}"); } // DECOMMISSION a model await client.DecommissionModelAsync(buildingModelId).ConfigureAwait(false); } catch (Exception ex) { Assert.Fail($"Failure in executing a step in the test case: {ex.Message}."); } finally { // Test DELETE all models. try { await client.DeleteModelAsync(buildingModelId).ConfigureAwait(false); await client.DeleteModelAsync(hvacModelId).ConfigureAwait(false); await client.DeleteModelAsync(wardModelId).ConfigureAwait(false); } catch (Exception ex) { Assert.Fail($"Test clean up failed: {ex.Message}"); } } }