public void Editing_A_Runtime_From_Dictionary_Should_Give_A_New_Runtime() { var runtimemodel = new RuntimeModel(); var newValue = 0; var checkpointid = 0; Given("we have a runtime", () => { timer.Start(); checkpointid = timer.GetFirstCheckpointId(); runtimemodel = timer.AddRuntime(500, checkpointid); }); When("we want to change the runtime", () => { timer.EditRuntime(runtimemodel.Id, 0, 1, 32, 20); newValue = Convert.ToInt32(timer.CheckpointRuntimes[checkpointid].First().Value); }); Then("the new runtime shouldn't be equal to the previous", () => newValue.ShouldNotBe(runtimemodel.Runtime)); }
/// <summary> /// Deletes the runtime. /// </summary> /// <param name="runtime">The runtime.</param> public void DeleteRuntime(RuntimeModel runtime) { CheckpointRuntimes[CurrentCheckpointId].Remove(runtime.Id); using (var ctx = new Entities()) { var runtimeToDelete = ctx.Runtimes.Where(runt => runt.RuntimeID == runtime.Id).Single(); runtimeToDelete.IsDeleted = true; ctx.SaveChanges(); } }
public void Deleting_A_Runtime_From_Dictionary_Should_Reduce_The_Dictionary_With_1() { var runtime = new RuntimeModel(); var listcount = 0; var checkpointid = 0; Given("we have a runtimelist", () => { timer.Start(); checkpointid = timer.GetFirstCheckpointId(); runtime = timer.AddRuntime(300, checkpointid); listcount = timer.CheckpointRuntimes[checkpointid].Count; }); When("we want to delete a runtime", () => { timer.DeleteRuntime(runtime); }); Then("the runtime list should be rduced with 1", () => { timer.CheckpointRuntimes[checkpointid].Count.ShouldBe(listcount - 1); }); }
/// <summary> /// Adds the runtime. /// </summary> /// <param name="runtimemodel">The runtimemodel.</param> public void AddRuntime(RuntimeModel runtimemodel) { RuntimeModel.Create(runtimemodel.Runtime, runtimemodel.CheckPointId); var checkpointRuntimeDic = CheckpointRuntimes[CurrentCheckpointId]; checkpointRuntimeDic.Add(runtimemodel.Id, runtimemodel.Runtime); if (CheckpointRuntimes.ContainsKey(CurrentCheckpointId)) CheckpointRuntimes[CurrentCheckpointId] = checkpointRuntimeDic; else CheckpointRuntimes.Add(CurrentCheckpointId, checkpointRuntimeDic); }