public void AddScenario_ValidParameters_CreatesScenario() { string procedureName = "Procedure"; string scenarioName = "Scenario"; Procedure procedure = new Procedure(procedureName); procedure.AddScenario(scenarioName); Scenario scenario = procedure.Scenarios.Single(s => s.Name == scenarioName); Assert.AreEqual(scenarioName, scenario.Name); }
/// <summary> /// Handles the specified command. /// </summary> /// <param name="command">The command.</param> /// <returns></returns> public async Task <Scenario> Handle(CreateScenarioCommand command) { if (command == null) { throw new ArgumentNullException(nameof(command)); } Procedure procedure = await this._repository.Get(command.ProcedureId); Scenario scenario = procedure.AddScenario(command.Name); await this._repository.Update(procedure); this._eventBus.Publish(new ScenarioCreatedEvent(procedure.Id, scenario.Id, scenario.Name)); return(scenario); }