public ActionResult ExpectedChildren(string id, ExpectedChildren expectedChildren) { var cmd = new AddExpectedChildren { FormId = id, ExpectedChildren = expectedChildren, }; return(Exec(cmd, success: next => RedirectNext(next), failure: () => ExpectedChildren_Render(id, expectedChildren))); }
public void Execute_StoresExpectedChildren() { var existingForm = new ChangeOfCircsBuilder("form123") .Insert(); existingForm.ExpectedChildren.Should().BeNull("no data stored before executing command"); var cmd = new AddExpectedChildren { FormId = "form123", ExpectedChildren = ExpectedChildrenBuilder.NewValid(), }; cmd.Execute(); var updatedForm = Repository.Load <ChangeOfCircs>("form123"); updatedForm.ExpectedChildren.Should().NotBeNull(); updatedForm.ExpectedChildren.ExpectancyDate.Should().Be(cmd.ExpectedChildren.ExpectancyDate); }
public void Execute_StoresExpectedDetails() { var existingForm = new BestStartGrantBuilder("form123") .With(f => f.ApplicantDetails, ApplicantDetailsBuilder.NewValid()) .Insert(); existingForm.ExpectedChildren.Should().BeNull("no data stored before executing command"); var cmd = new AddExpectedChildren { FormId = "form123", ExpectedChildren = ExpectedChildrenBuilder.NewValid(), }; cmd.Execute(); var updatedForm = Repository.Load <BestStartGrant>("form123"); updatedForm.ExpectedChildren.Should().NotBeNull(); updatedForm.ExpectedChildren.ExpectancyDate.Should().Be(cmd.ExpectedChildren.ExpectancyDate); }