public void SetGoal(VisaGoal goal) { Apply(new VisaEvents.GoalChanged { Goal = goal }); }
protected override void When(object @event) { Requirement requirement; switch (@event) { case VisaEvents.Created e: Id = new VisaId(e.Id); Type = e.Type; Goal = VisaGoal.NoGoal; ExpectedProcessingTime = VisaExpectedProcessingTime.NoExpectedProcessingTime; break; case VisaEvents.GoalChanged e: Goal = new VisaGoal(e.Goal); break; case VisaEvents.TypeUpdated e: Type = e.Type; break; case VisaEvents.ExceptedProcessingTimeChanged e: ExpectedProcessingTime = new VisaExpectedProcessingTime(e.ExceptedProcessingTime); break; case RequirementEvents.AddedToVisa e: requirement = new Requirement(Apply); ApplyToEntity(requirement, e); Requirements.Add(requirement); break; case RequirementEvents.NameChanged e: requirement = FindRequirement(new RequirementId(e.Id)); ApplyToEntity(requirement, e); break; case RequirementEvents.ExampleChanged e: requirement = FindRequirement(new RequirementId(e.Id)); ApplyToEntity(requirement, e); break; case RequirementEvents.DescriptionChanged e: requirement = FindRequirement(new RequirementId(e.Id)); ApplyToEntity(requirement, e); break; } }