Allow to delete simulations and change count of devices in the default template (#34)

* Allow to delete simulations and change the count of devices in the template
* Bump version number
This commit is contained in:
Devis Lucato 2017-08-21 17:47:50 -07:00 коммит произвёл GitHub
Родитель 570645bf2e
Коммит fd79551bc0
5 изменённых файлов: 18 добавлений и 6 удалений

Просмотреть файл

@ -81,7 +81,7 @@ namespace Services.Test
public void CreateDefaultSimulation()
{
// Arrange
const int defaultDeviceCount = 2;
const int defaultDeviceCount = 1;
this.ThereAreNoSimulationsInTheStorage();
this.ThereAreSomeDeviceModels();

Просмотреть файл

@ -18,13 +18,14 @@ namespace Microsoft.Azure.IoTSolutions.DeviceSimulation.Services
Task<Models.Simulation> InsertAsync(Models.Simulation simulation, string template = "");
Task<Models.Simulation> UpsertAsync(Models.Simulation simulation);
Task<Models.Simulation> 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);
}
}
}

Просмотреть файл

@ -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);
}
}
}

Просмотреть файл

@ -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() {

Просмотреть файл

@ -1 +1 @@
0.1.5
0.1.6