public void SellAccomodationShouldInformUserWhenAccomodationIsAlreadySold() { //Init var clientModel = new SellAccomodationModel { AccomodationNumber = AccomodationTest.GetAccomodation().Number, PersonId = "1" }; var person = PersonTest.GetPersonWithoutId(); var accomodation = AccomodationTest.GetAccomodation(); var personService = Substitute.For <PersonService>(); var clientService = Substitute.For <ClientService>(); var prospectService = Substitute.For <ProspectService>(); var accomodationService = Substitute.For <AccomodationService>(); var personQuery = Substitute.For <PersonQueryExtended>(); var accomodationQuery = Substitute.For <AccomodationQueryExtended>(); var controller = new ControllerImpl(personService, clientService, prospectService, accomodationService, personQuery, accomodationQuery); clientService .When(c => c.SellAccomodation(person, accomodation)) .Do(c => { throw new AccomodationAlreadySoldException(); }); //Act var message = controller.SellAccomodation(clientModel); //Assert Check.That(message).IsEqualTo("Accomodation Sold !"); }
public void ClientShouldNotAcceptNullAccomodation() { Accomodation accomodation = null; Action action = () => new Client(PersonTest.GetPersonWithoutId(), accomodation); Check.ThatCode(action).Throws <ArgumentNullException>(); }
public void PersonPropertyShouldBeTheSameAsConstructorParameter() { Check.That(this.client.Person).IsEqualTo(PersonTest.GetPersonWithoutId()); }
public ClientTest() { var person = PersonTest.GetPersonWithoutId(); this.client = new Client(person, AccomodationTest.GetAccomodation()); }
public void PersonPropertyShouldBeTheSameAsConstructorParameter() { var prospect = GetProspect(); Check.That(prospect.Person).IsEqualTo(PersonTest.GetPersonWithoutId()); }
private static Prospect GetProspect() { return(new Prospect(PersonTest.GetPersonWithoutId(), AccomodationTest.GetAccomodation())); }