diff --git a/Services.Test/SimulationsTest.cs b/Services.Test/SimulationsTest.cs index 3a326753..c65663b3 100644 --- a/Services.Test/SimulationsTest.cs +++ b/Services.Test/SimulationsTest.cs @@ -81,7 +81,7 @@ namespace Services.Test public void CreateDefaultSimulation() { // Arrange - const int defaultDeviceCount = 2; + const int defaultDeviceCount = 1; this.ThereAreNoSimulationsInTheStorage(); this.ThereAreSomeDeviceModels(); diff --git a/Services/Simulations.cs b/Services/Simulations.cs index 6d102b42..eb10b96f 100644 --- a/Services/Simulations.cs +++ b/Services/Simulations.cs @@ -18,13 +18,14 @@ namespace Microsoft.Azure.IoTSolutions.DeviceSimulation.Services Task InsertAsync(Models.Simulation simulation, string template = ""); Task UpsertAsync(Models.Simulation simulation); Task MergeAsync(SimulationPatch patch); + Task DeleteAsync(string id); } public class Simulations : ISimulations { private const string StorageCollection = "simulations"; private const string SimulationId = "1"; - private const int DevicesPerModelInDefaultTemplate = 2; + private const int DevicesPerModelInDefaultTemplate = 1; private readonly IDeviceModels deviceModels; private readonly IStorageAdapterClient storage; @@ -189,5 +190,11 @@ namespace Microsoft.Azure.IoTSolutions.DeviceSimulation.Services return simulation; } + + + public async Task DeleteAsync(string id) + { + await this.storage.DeleteAsync(StorageCollection, id); + } } } diff --git a/WebService/v1/Controllers/SimulationsController.cs b/WebService/v1/Controllers/SimulationsController.cs index eecbfa0d..0eb74176 100644 --- a/WebService/v1/Controllers/SimulationsController.cs +++ b/WebService/v1/Controllers/SimulationsController.cs @@ -85,5 +85,11 @@ namespace Microsoft.Azure.IoTSolutions.DeviceSimulation.WebService.v1.Controller return new SimulationApiModel( await this.simulationsService.MergeAsync(patch.ToServiceModel(id))); } + + [HttpDelete("{id}")] + public async Task DeleteAsync(string id) + { + await this.simulationsService.DeleteAsync(id); + } } } diff --git a/scripts/run b/scripts/run index 295b6a24..73848df7 100755 --- a/scripts/run +++ b/scripts/run @@ -82,9 +82,8 @@ prepare_for_run() { run_all() { echo "Starting simulation agent and web service..." - dotnet run --configuration $CONFIGURATION --project SimulationAgent/*.csproj & \ - dotnet run --configuration $CONFIGURATION --project WebService/*.csproj && \ - fg + dotnet run --configuration $CONFIGURATION --project WebService/*.csproj & \ + dotnet run --configuration $CONFIGURATION --project SimulationAgent/*.csproj } run_webservice() { diff --git a/version b/version index 9faa1b7a..c946ee61 100644 --- a/version +++ b/version @@ -1 +1 @@ -0.1.5 +0.1.6