Ejemplo n.º 1
0
        public void TestCreateBookingAsync()
        {
            ContextSeeders.Seed();
            var crbo  = new ClientRecordBusinessObject();
            var bbo   = new BookingBusinessObject();
            var pbo   = new PersonBusinessObject();
            var rbo   = new RestaurantBusinessObject();
            var lhubo = new LennyouseUserBusinessObject();

            var _lennyouseUser = new LennyouseUser(Guid.NewGuid());
            var newP           = new Person(11111, 11111, "ok", "ok", DateTime.UtcNow, _lennyouseUser.Id);
            var newR           = new Restaurant("ok", "ok", "ok", "ok", "ok", 5);



            var cr      = new ClientRecord(DateTime.UtcNow, newP.Id, newR.Id);
            var booking = new Booking(cr.Id, DateTime.UtcNow);



            crbo.Create(cr);
            pbo.Create(newP);
            rbo.Create(newR);
            lhubo.Create(_lennyouseUser);

            var resCreate = bbo.CreateAsync(booking).Result;
            var resGet    = bbo.ReadAsync(booking.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
        public void TestCreateClientRecordAsync()
        {
            ContextSeeders.Seed();
            var crbo = new ClientRecordBusinessObject();
            var lubo = new LennyouseUserBusinessObject();
            var pbo  = new PersonBusinessObject();

            var _lennyouseUser = new LennyouseUser(Guid.NewGuid());

            lubo.Create(_lennyouseUser);

            var _person = new Person(123456789, 934657823, "Miguel", "Silva", DateTime.UtcNow, _lennyouseUser.Id);

            pbo.Create(_person);

            var rbo        = new RestaurantBusinessObject();
            var _resturant = new Restaurant("Dom Pedro", "Rua das Flores 2", "2 p.m", "9 p.m", "Fridays", 2);

            rbo.Create(_resturant);

            var _clientRecord = new ClientRecord(DateTime.UtcNow, _person.Id, _resturant.Id);

            var resCreate = crbo.CreateAsync(_clientRecord).Result;
            var resGet    = crbo.ReadAsync(_clientRecord.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
Ejemplo n.º 3
0
        public void TestCreateStaffRecordAsync()
        {
            ContextSeeders.Seed();
            var srbo = new StaffRecordBusinessObject();
            var pbo  = new PersonBusinessObject();
            var rbo  = new RestaurantBusinessObject();
            var lubo = new LennyouseUserBusinessObject();

            var _lennyouseUser = new LennyouseUser(Guid.NewGuid());

            lubo.Create(_lennyouseUser);

            var _person = new Person(1234321, 23432456, "Marco", "Figueirnha", DateTime.UtcNow, _lennyouseUser.Id);

            pbo.Create(_person);

            var _restaurant = new Restaurant("Tasca do sol", "Bairro Alto 2", "12h", "00h", "Mondays", 3);

            rbo.Create(_restaurant);

            var _staffRecord = new StaffRecord(DateTime.UtcNow, DateTime.UtcNow, _person.Id, _restaurant.Id);

            var resCreate = srbo.CreateAsync(_staffRecord).Result;
            var resGet    = srbo.ReadAsync(_staffRecord.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
Ejemplo n.º 4
0
        public void TestUpdatePerson()
        {
            ContextSeeders.Seed();
            var pbo     = new PersonBusinessObject();
            var resList = pbo.List();
            var item    = resList.Result.FirstOrDefault();

            var lubo = new LennyouseUserBusinessObject();

            var _lennyouseUser = new LennyouseUser(Guid.NewGuid());

            lubo.Create(_lennyouseUser);

            var _newPerson = new Person(3654324444, 1111111, "Marco", "Figueirinha", DateTime.UtcNow, _lennyouseUser.Id);

            item.VatNumber       = _newPerson.VatNumber;
            item.PhoneNumber     = _newPerson.PhoneNumber;
            item.FirstName       = _newPerson.FirstName;
            item.LastName        = _newPerson.LastName;
            item.BirthDate       = _newPerson.BirthDate;
            item.LennyouseUserId = _newPerson.LennyouseUserId;

            var resUpdate = pbo.Update(item);

            resList = pbo.List();

            Assert.IsTrue(resList.Success && resUpdate.Success &&
                          resList.Result.First().VatNumber == _newPerson.VatNumber &&
                          resList.Result.First().PhoneNumber == _newPerson.PhoneNumber &&
                          resList.Result.First().FirstName == _newPerson.FirstName &&
                          resList.Result.First().LastName == _newPerson.LastName &&
                          resList.Result.First().BirthDate == _newPerson.BirthDate &&
                          resList.Result.First().LennyouseUserId == _newPerson.LennyouseUserId
                          );
        }
Ejemplo n.º 5
0
        public void TestListLennyouseUserAsync()
        {
            ContextSeeders.Seed();
            var bo      = new LennyouseUserBusinessObject();
            var resList = bo.ListAsync().Result;

            Assert.IsTrue(resList.Success && resList.Result.Count == 1);
        }
Ejemplo n.º 6
0
        public void TestCreateLennyouseUserAsync()
        {
            ContextSeeders.Seed();
            var lubo = new LennyouseUserBusinessObject();

            var _lennyouseUser = new LennyouseUser(Guid.NewGuid());

            var resCreate = lubo.CreateAsync(_lennyouseUser).Result;
            var resGet    = lubo.ReadAsync(_lennyouseUser.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
Ejemplo n.º 7
0
        public void TestDeleteLennyouseUserAsync()
        {
            ContextSeeders.Seed();
            var bo = new LennyouseUserBusinessObject();

            var resList   = bo.List();
            var resDelete = bo.Delete(resList.Result.First().Id);

            resList = bo.ListAsync().Result;

            Assert.IsTrue(resDelete.Success && resList.Success);
        }
Ejemplo n.º 8
0
        public void TestCreatePersonAsync()
        {
            ContextSeeders.Seed();
            var pbo  = new PersonBusinessObject();
            var lubo = new LennyouseUserBusinessObject();

            var _lennyouseUser = new LennyouseUser(Guid.NewGuid());

            lubo.Create(_lennyouseUser);

            var _person   = new Person(3654324444, 0000000, "Marco", "Figueirnha", DateTime.UtcNow, _lennyouseUser.Id);
            var resCreate = pbo.CreateAsync(_person).Result;
            var resGet    = pbo.ReadAsync(_person.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
Ejemplo n.º 9
0
        public void TestUpdateLennyouseUserAsync()
        {
            ContextSeeders.Seed();
            var lubo    = new LennyouseUserBusinessObject();
            var resList = lubo.List();
            var item    = resList.Result.FirstOrDefault();

            var _newLennyouseUser = new LennyouseUser(Guid.NewGuid());

            item.PersonId = _newLennyouseUser.PersonId;

            var resUpdate = lubo.UpdateAsync(item).Result;

            resList = lubo.ListAsync().Result;

            Assert.IsTrue(resList.Success && resUpdate.Success &&
                          resList.Result.First().PersonId == _newLennyouseUser.PersonId);
        }
Ejemplo n.º 10
0
        public void TestUpdateStaffRecord()
        {
            ContextSeeders.Seed();
            var srbo    = new StaffRecordBusinessObject();
            var resList = srbo.List();
            var item    = resList.Result.FirstOrDefault();

            var pbo  = new PersonBusinessObject();
            var rbo  = new RestaurantBusinessObject();
            var lubo = new LennyouseUserBusinessObject();

            var _lennyouseUser = new LennyouseUser(Guid.NewGuid());

            lubo.Create(_lennyouseUser);

            var _person = new Person(3654324444, 0000000, "Marco", "Figueirnha", DateTime.UtcNow, _lennyouseUser.Id);

            pbo.Create(_person);

            var _restaurant = new Restaurant("Tasca da Lua", "Bairro Alto 2", "12h", "00h", "Mondays", 7);

            rbo.Create(_restaurant);


            var _newStaffRecord = new StaffRecord(DateTime.UtcNow, DateTime.UtcNow, _person.Id, _restaurant.Id);

            item.BeginDate    = _newStaffRecord.BeginDate;
            item.EndDate      = _newStaffRecord.EndDate;
            item.PersonId     = _newStaffRecord.PersonId;
            item.RestaurantId = _newStaffRecord.RestaurantId;

            var resUpdate = srbo.Update(item);

            resList = srbo.List();

            Assert.IsTrue(resList.Success && resUpdate.Success &&
                          resList.Result.First().BeginDate == _newStaffRecord.BeginDate &&
                          resList.Result.First().EndDate == _newStaffRecord.EndDate &&
                          resList.Result.First().PersonId == _newStaffRecord.PersonId &&
                          resList.Result.First().RestaurantId == _newStaffRecord.RestaurantId
                          );
        }
Ejemplo n.º 11
0
        public void TestUpdateBookingAsync()
        {
            ContextSeeders.Seed();
            var bbo     = new BookingBusinessObject();
            var resList = bbo.List();
            var item    = resList.Result.FirstOrDefault();


            var crbo  = new ClientRecordBusinessObject();
            var pbo   = new PersonBusinessObject();
            var rbo   = new RestaurantBusinessObject();
            var lhubo = new LennyouseUserBusinessObject();

            var _lennyouseUser = new LennyouseUser(Guid.NewGuid());
            var newP           = new Person(11111, 11111, "ok", "ok", DateTime.UtcNow, _lennyouseUser.Id);
            var newR           = new Restaurant("ok", "ok", "ok", "ok", "ok", 5);



            var cr      = new ClientRecord(DateTime.UtcNow, newP.Id, newR.Id);
            var booking = new Booking(cr.Id, DateTime.UtcNow);


            crbo.Create(cr);
            pbo.Create(newP);
            rbo.Create(newR);
            lhubo.Create(_lennyouseUser);


            item.ClientRecordId = booking.ClientRecordId;

            var resUpdate = bbo.UpdateAsync(item).Result;

            resList = bbo.ListAsync().Result;

            Assert.IsTrue(resList.Success && resUpdate.Success &&
                          resList.Result.First().ClientRecordId == booking.ClientRecordId &&
                          resList.Result.First().Date == booking.Date);
        }
        public void TestUpdateClientRecord()
        {
            ContextSeeders.Seed();
            var crbo    = new ClientRecordBusinessObject();
            var resList = crbo.List();
            var item    = resList.Result.FirstOrDefault();

            var lubo = new LennyouseUserBusinessObject();
            var pbo  = new PersonBusinessObject();
            var rbo  = new RestaurantBusinessObject();

            var _lennyouseUser = new LennyouseUser(Guid.NewGuid());

            lubo.Create(_lennyouseUser);

            var _person = new Person(98764321, 364857484, "Ana", "Pereira", DateTime.UtcNow, _lennyouseUser.Id);

            pbo.Create(_person);


            var _resturant = new Restaurant("Dona Ivone", "Rua dos Anjos 2", "2 p.m", "9 p.m", "Sundays", 2);

            rbo.Create(_resturant);

            var _newclientRecord = new ClientRecord(DateTime.UtcNow, _person.Id, _resturant.Id);

            item.RegisterDate = _newclientRecord.RegisterDate;
            item.PersonId     = _newclientRecord.PersonId;
            item.RestaurantId = _newclientRecord.RestaurantId;

            var resUpdate = crbo.Update(item);

            resList = crbo.List();

            Assert.IsTrue(resList.Success && resUpdate.Success &&
                          resList.Result.First().RegisterDate == _newclientRecord.RegisterDate && resList.Result.First().RestaurantId == _newclientRecord.RestaurantId &&
                          resList.Result.First().PersonId == _newclientRecord.PersonId);
        }