Ejemplo n.º 1
0
        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 !");
        }
Ejemplo n.º 2
0
        public void ClientShouldNotAcceptNullAccomodation()
        {
            Accomodation accomodation = null;

            Action action = () => new Client(PersonTest.GetPersonWithoutId(), accomodation);

            Check.ThatCode(action).Throws <ArgumentNullException>();
        }
Ejemplo n.º 3
0
 public void PersonPropertyShouldBeTheSameAsConstructorParameter()
 {
     Check.That(this.client.Person).IsEqualTo(PersonTest.GetPersonWithoutId());
 }
Ejemplo n.º 4
0
        public ClientTest()
        {
            var person = PersonTest.GetPersonWithoutId();

            this.client = new Client(person, AccomodationTest.GetAccomodation());
        }
Ejemplo n.º 5
0
        public void PersonPropertyShouldBeTheSameAsConstructorParameter()
        {
            var prospect = GetProspect();

            Check.That(prospect.Person).IsEqualTo(PersonTest.GetPersonWithoutId());
        }
Ejemplo n.º 6
0
 private static Prospect GetProspect()
 {
     return(new Prospect(PersonTest.GetPersonWithoutId(), AccomodationTest.GetAccomodation()));
 }