public void Create_person_decider_should_fail_if_the_person_does_not_have_a_name() { var perceptionStatement = new StatementExtension() { verb = new TinCan.Verb() { id = new Uri(Verb.PersonCreationRequested) } }; perceptionStatement.populateTarget(new Person()); var decisionStatement = _personDomainService.CreatePersonDecider(perceptionStatement, null); Assert.AreEqual(decisionStatement.verb.id, Verb.PersonCreationFailed); }
public void Create_person_decider_should_populate_the_new_target_id_after_creating_the_person() { var perceptionStatement = new StatementExtension() { verb = new TinCan.Verb() { id = new Uri(Verb.PersonCreationRequested) } }; var person = new Person() { Name = "Test" }; perceptionStatement.populateTarget(person); var decisionStatement = _personDomainService.CreatePersonDecider(perceptionStatement, person); Assert.AreEqual(((TinCan.Activity)decisionStatement.target).id, decisionStatement.targetData <Person>().Id); }
public void Create_person_decider_should_create_the_person_if_the_person_has_a_name() { var perceptionStatement = new StatementExtension() { verb = new TinCan.Verb() { id = new Uri(Verb.PersonCreationRequested) } }; var person = new Person() { Name = "Test" }; perceptionStatement.populateTarget(person); var decisionStatement = _personDomainService.CreatePersonDecider(perceptionStatement, person); Assert.AreEqual(decisionStatement.verb.id, Verb.PersonCreated); Assert.AreEqual(decisionStatement.targetData <Person>().Name, person.Name); }