Esempio 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 !");
        }
Esempio n. 2
0
        public void ClientShouldNotAcceptNullPerson()
        {
            Person person = null;

            Action action = () => new Client(person, AccomodationTest.GetAccomodation());

            Check.ThatCode(action).Throws <ArgumentNullException>();
        }
        public ProspectServiceImplTest()
        {
            this.person = PersonTest.GetPerson(Option.None <PersonFirstName>(),
                                               Option.None <PersonName>(), Option.None <PersonEmail>());
            this.personRepository = Substitute.For <PersonRepository>();

            this.accomodation = AccomodationTest.GetAccomodation();

            this.personQuery = Substitute.For <PersonQuery>();
            this.personQuery.Exist(this.person).Returns(true);
            this.personQuery.IsProspectOnThisAccomodation(this.person, this.accomodation).Returns(false);

            this.accomodationQuery = Substitute.For <AccomodationQuery>();
            this.accomodationQuery.Exist(this.accomodation).Returns(true);

            this.prospectService = new ProspectServiceImpl(this.personRepository, this.personQuery, this.accomodationQuery);
        }
Esempio n. 4
0
        public ClientServiceImplTest()
        {
            this.person = new Person(
                Option.None <string>(),
                PersonFirstName.Create("john").Value,
                PersonName.Create("smith").Value,
                PersonEmail.Create("*****@*****.**").Value);
            this.personQuery = Substitute.For <PersonQuery>();
            this.personQuery.Exist(this.person).Returns(true);

            var mediator = Substitute.For <IMediator>();

            this.personRepository = Substitute.For <PersonRepository>();

            this.accomodation      = AccomodationTest.GetAccomodation();
            this.accomodationQuery = Substitute.For <AccomodationQuery>();
            this.accomodationQuery.Exist(this.accomodation).Returns(true);
            this.personQuery.IsAccomodationSold(this.accomodation).Returns(false);

            this.clientService = new ClientServiceImpl(this.personRepository,
                                                       this.personQuery, this.accomodationQuery, mediator);
        }
Esempio n. 5
0
 public void AccomodationPropertyShouldBeTheSameAsConstructorParameter()
 {
     Check.That(this.client.Accomodation).IsEqualTo(AccomodationTest.GetAccomodation());
 }
Esempio n. 6
0
        public ClientTest()
        {
            var person = PersonTest.GetPersonWithoutId();

            this.client = new Client(person, AccomodationTest.GetAccomodation());
        }
Esempio n. 7
0
        public void AccomodationPropertyShouldBeTheSameAsConstructorParameter()
        {
            var prospect = GetProspect();

            Check.That(prospect.Accomodation).IsEqualTo(AccomodationTest.GetAccomodation());
        }
Esempio n. 8
0
 private static Prospect GetProspect()
 {
     return(new Prospect(PersonTest.GetPersonWithoutId(), AccomodationTest.GetAccomodation()));
 }