public void GetOneAddressByID()
 {
     using (EFAddressMapper mapper = new EFAddressMapper(CONNECTION_STRING))
     {
         Assert.AreEqual(AddressClassic1.Road, mapper.FindBy(2).Road);
     }
 }
 public void AddAddressWithoutCountry()
 {
     using (EFAddressMapper mapper = new EFAddressMapper(CONNECTION_STRING))
     {
         mapper.AddorUpdate(AddressWithoutCountry);
     }
 }
 public void GetAllAddress()
 {
     using (EFAddressMapper mapper = new EFAddressMapper(CONNECTION_STRING))
     {
         Assert.AreEqual(3, mapper.GetAll().Count);
     }
 }
 public void GetOneAddressBysearch()
 {
     using (EFAddressMapper mapper = new EFAddressMapper(CONNECTION_STRING))
     {
         Expression <Func <Address, bool> > expression = a => a.Road == AddressClassic2.Road && a.Number == AddressClassic2.Number;
         Assert.AreEqual(1, mapper.FindBy(expression).Count);
     }
 }
 public void AddEmptyAddress()
 {
     using (EFAddressMapper mapper = new EFAddressMapper(CONNECTION_STRING))
     {
         mapper.AddorUpdate(AddressEmpty);
         Assert.AreEqual(3, mapper.GetAll().Count);
     }
 }
 public void AddAddressWithoutPostalCode()
 {
     using (EFAddressMapper mapper = new EFAddressMapper(CONNECTION_STRING))
     {
         mapper.AddorUpdate(AddressWithoutPostalCode);
         Assert.AreEqual(3, mapper.GetAll().Count);
     }
 }
        public void AddAddressClassic()
        {
            using (EFAddressMapper mapper = new EFAddressMapper(CONNECTION_STRING))
            {
                mapper.AddorUpdate(AddressClassic1);

                Assert.AreEqual(1, mapper.GetAll().Count);
            }
        }
        public void DeleteAddress()
        {
            using (EFAddressMapper mapper = new EFAddressMapper(CONNECTION_STRING))
            {
                mapper.Delete(3);

                Expression <Func <Address, bool> > expression = a => a.ID == 3;
                Assert.AreEqual(0, mapper.FindBy(expression).Count);
            }
        }
        public void AddAddresses()
        {
            List <Address> adresses = new List <Address> {
                AddressClassic1, AddressClassic2
            };

            using (EFAddressMapper mapper = new EFAddressMapper(CONNECTION_STRING))
            {
                mapper.AddorUpdate(adresses);

                Assert.AreEqual(3, mapper.GetAll().Count);
            }
        }
        public void UpdateAddress()
        {
            using (EFAddressMapper mapper = new EFAddressMapper(CONNECTION_STRING))
            {
                AddressClassic3 = mapper.AddorUpdate(AddressClassic3);

                AddressClassic3.Number = "105";

                mapper.AddorUpdate(AddressClassic3);


                Expression <Func <Address, bool> > expression = a => a.ID == AddressClassic3.ID;
                Assert.AreEqual("105", mapper.FindBy(AddressClassic3.ID).Number);
            }
        }
Ejemplo n.º 11
0
        public void Setup()
        {
            addresses = new List <Address> {
                new Address()
                {
                    Country = "Belgique", Locality = "Ouffet", Number = "7", PostalCode = "4590", Road = "Sauveniere"
                },
                new Address()
                {
                    Country = "Belgique", Locality = "Liege", Number = "82", PostalCode = "4000", Road = "Leman"
                },
                new Address()
                {
                    Country = "France", Locality = "Paris", Number = "100", PostalCode = "10000", Road = "efle"
                },
                new Address()
                {
                    Country = "Italie", Locality = "Rome", Number = "97", PostalCode = "8520", Road = "pize"
                }
            };
            using (EFAddressMapper mapper = new EFAddressMapper(CONNECTION_STRING))
            {
                addresses = mapper.AddorUpdate(addresses);
            }

            users = new List <User> {
                new User()
                {
                    Login = "******", Password = "******", Name = "bologne", LastName = "sauce", Email = "*****@*****.**", Phone = "0475859565", Rank = UserRank.Member, Address = addresses[0]
                }
                , new User()
                {
                    Login = "******", Password = "******", Name = "coucou", LastName = "carle", Email = "*****@*****.**", Phone = "0465958565", Rank = UserRank.Member, Address = addresses[1]
                }
                , new User()
                {
                    Login = "******", Password = "******", Name = "polo", LastName = "lolo", Email = "*****@*****.**", Phone = "0456958565", Rank = UserRank.Member, Address = addresses[2]
                }
            };
            using (EFUserMapper mapper = new EFUserMapper(CONNECTION_STRING))
            {
                users = mapper.AddorUpdate(users);
            }

            journeyClassic1 = new Journey()
            {
                Description = "trajet 1", Driver = users[0], FreeSeat = 4, StartingAddress = addresses[0], DriverUpAddress = addresses[1], StartingDateTime = new DateTime(2017, 06, 12, 14, 30, 0), DriverUpDatetime = new DateTime(2017, 06, 12, 18, 40, 0), Passengers = new List <User>()
            };
            journeyClassic2 = new Journey()
            {
                Description = "trajet 2", Driver = users[1], FreeSeat = 4, StartingAddress = addresses[2], DriverUpAddress = addresses[1], StartingDateTime = new DateTime(2017, 06, 12, 14, 30, 0), DriverUpDatetime = new DateTime(2017, 06, 12, 18, 40, 0), Passengers = new List <User>()
            };
            journeyClassic3 = new Journey()
            {
                Description = "trajet 3", Driver = users[0], FreeSeat = 4, StartingAddress = addresses[3], DriverUpAddress = addresses[2], StartingDateTime = new DateTime(2017, 06, 12, 14, 30, 0), DriverUpDatetime = new DateTime(2017, 06, 12, 18, 40, 0), Passengers = new List <User>()
            };
            journeyClassic4 = new Journey()
            {
                Description = "trajet 4", Driver = users[0], FreeSeat = 4, StartingAddress = addresses[3], DriverUpAddress = addresses[2], StartingDateTime = new DateTime(2017, 06, 12, 14, 30, 0), DriverUpDatetime = new DateTime(2017, 06, 12, 18, 40, 0), Passengers = new List <User>()
            };
            journeyWithoutDescription = new Journey()
            {
                Driver = users[0], FreeSeat = 4, StartingAddress = addresses[0], DriverUpAddress = addresses[1], StartingDateTime = new DateTime(2017, 06, 12, 14, 30, 0), DriverUpDatetime = new DateTime(2017, 06, 12, 18, 40, 0), Passengers = new List <User>()
            };
            journeyWithoutFreeSeat = new Journey()
            {
                Description = "trajet 1", Driver = users[0], StartingAddress = addresses[0], DriverUpAddress = addresses[1], StartingDateTime = new DateTime(2017, 06, 12, 14, 30, 0), DriverUpDatetime = new DateTime(2017, 06, 12, 18, 40, 0), Passengers = new List <User>()
            };
            journeyWithoutDriver = new Journey()
            {
                Description = "trajet 1", FreeSeat = 4, StartingAddress = addresses[0], DriverUpAddress = addresses[1], StartingDateTime = new DateTime(2017, 06, 12, 14, 30, 0), DriverUpDatetime = new DateTime(2017, 06, 12, 18, 40, 0), Passengers = new List <User>()
            };
            journeyWithoutStartingAddress = new Journey()
            {
                Description = "trajet 1", Driver = users[0], FreeSeat = 4, DriverUpAddress = addresses[1], StartingDateTime = new DateTime(2017, 06, 12, 14, 30, 0), DriverUpDatetime = new DateTime(2017, 06, 12, 18, 40, 0), Passengers = new List <User>()
            };
            journeyWithoutDriverUpAddress = new Journey()
            {
                Description = "trajet 1", Driver = users[0], FreeSeat = 4, StartingAddress = addresses[0], StartingDateTime = new DateTime(2017, 06, 12, 14, 30, 0), DriverUpDatetime = new DateTime(2017, 06, 12, 18, 40, 0), Passengers = new List <User>()
            };
            journeyWithoutStartingDateTime = new Journey()
            {
                Description = "trajet 1", Driver = users[0], FreeSeat = 4, StartingAddress = addresses[0], DriverUpAddress = addresses[1], DriverUpDatetime = new DateTime(2017, 06, 12, 18, 40, 0), Passengers = new List <User>()
            };
            journeyWithoutDriverUpDateTime = new Journey()
            {
                Description = "trajet 1", Driver = users[0], FreeSeat = 4, StartingAddress = addresses[0], DriverUpAddress = addresses[1], StartingDateTime = new DateTime(2017, 06, 12, 14, 30, 0), Passengers = new List <User>()
            };
            journeyEmpty = new Journey();
        }
Ejemplo n.º 12
0
        public void Setup()
        {
            EFAddressMapper addressMapper = new EFAddressMapper("Test-WebProject2017-DB");

            addresses = new List <Address> {
                new Address()
                {
                    Country = "Belgique", Locality = "Ouffet", Number = "7", PostalCode = "4590", Road = "Sauveniere"
                },
                new Address()
                {
                    Country = "Belgique", Locality = "Liege", Number = "82", PostalCode = "4000", Road = "Leman"
                }
            };
            AddressClassic3 = new Address()
            {
                Country = "France", Locality = "Paris", Number = "100", PostalCode = "10000", Road = "efle"
            };

            using (EFAddressMapper mapper = new EFAddressMapper(CONNECTION_STRING))
            {
                addresses = mapper.AddorUpdate(addresses);
            }

            userClassic1 = new User()
            {
                Login = "******", Password = "******", Name = "bologne", LastName = "sauce", Email = "*****@*****.**", Phone = "0475859565", Rank = UserRank.Member, Address = addresses.First()
            };
            userClassic2 = new User()
            {
                Login = "******", Password = "******", Name = "coucou", LastName = "carle", Email = "*****@*****.**", Phone = "0465958565", Rank = UserRank.Member, Address = addresses.Last()
            };
            userClassic3 = new User()
            {
                Login = "******", Password = "******", Name = "polo", LastName = "lolo", Email = "*****@*****.**", Phone = "0456958565", Rank = UserRank.Member, Address = addresses.Last()
            };
            userClassic4 = new User()
            {
                Login = "******", Password = "******", Name = "polo", LastName = "lolo", Email = "*****@*****.**", Phone = "0456958565", Rank = UserRank.Member, Address = addresses.Last()
            };
            userClassic5 = new User()
            {
                Login = "******", Password = "******", Name = "polo", LastName = "lolo", Email = "*****@*****.**", Phone = "0456958565", Rank = UserRank.Member, Address = addresses.Last()
            };
            userWithoutLogin = new User()
            {
                Password = "******", Name = "bologne", LastName = "sauce", Email = "*****@*****.**", Phone = "0475859565", Rank = UserRank.Member, Address = addresses.First()
            };
            userWithoutPassword = new User()
            {
                Login = "******", Name = "bologne", LastName = "sauce", Email = "*****@*****.**", Phone = "0475859565", Rank = UserRank.Member, Address = addresses.First()
            };
            userWithoutName = new User()
            {
                Login = "******", Password = "******", LastName = "sauce", Email = "*****@*****.**", Phone = "0475859565", Rank = UserRank.Member, Address = addresses.First()
            };
            userWithoutLastName = new User()
            {
                Login = "******", Password = "******", Name = "bologne", Email = "*****@*****.**", Phone = "0475859565", Rank = UserRank.Member, Address = addresses.First()
            };
            userWithoutEmail = new User()
            {
                Login = "******", Password = "******", Name = "bologne", LastName = "sauce", Phone = "0475859565", Rank = UserRank.Member, Address = addresses.First()
            };
            userWithoutPhone = new User()
            {
                Login = "******", Password = "******", Name = "bologne", LastName = "sauce", Email = "*****@*****.**", Rank = UserRank.Member, Address = addresses.First()
            };
            userWithoutAddress = new User()
            {
                Login = "******", Password = "******", Name = "bologne", LastName = "sauce", Email = "*****@*****.**", Phone = "0475859565", Rank = UserRank.Member
            };
            userWithoutUserRank = new User()
            {
                Login = "******", Password = "******", Name = "bologne", LastName = "sauce", Email = "*****@*****.**", Phone = "0475859565", Address = addresses.First()
            };
            userEmpty = new User();
        }