Exemplo n.º 1
0
        private void CreateMockHouses()
        {
            using (DatabaseContext context = new DatabaseContext())
            {
                filter      = new HouseSearchRequest();
                filter.City = "City";

                /*
                 *  filter.Address = "Adress";
                 *  filter.Price = 0;
                 *  filter.Skip = 10;
                 *  filter.Street = "Street";
                 *  filter.Take = 10;
                 *  filter.TypeRent = true;
                 *  filter.ZipCode = "ZipCode";
                 */
                for (int i = 0; i < 10; i++)
                {
                    House house = DomainMocksFactory.CreateHouse();
                    house.ModifyCode((i).ToString());
                    house.AddAddress("my address", "my city", "my country", "my st. number", "zip code");
                    house.AddCategory("my entry", "my description");
                    house.AssociateAgent(DomainMocksFactory.CreateAgent());
                    context.Houses.Add(house);
                }

                context.SaveChanges();
            }
        }
Exemplo n.º 2
0
        public static void Initialize()
        {
            // cleanup before start

            using (DatabaseContext context = new DatabaseContext())
            {
                Customer customer = Customer.Create("First Name", "Last Name", 43, "12345ABCDE");

                House firstHouse = House.Create("First house", "Description for the house", customer);
                firstHouse.AddAddress("111/1 Sokak", "Izmir", "Turkey", "23A", "35600");
                //---
                Customer customer2 = Customer.Create("First Name", "Last Name", 43, "12345ABCDE");

                House secondHouse = House.Create("First house", "Description for the house", customer2);
                secondHouse.AddAddress("222/1 Sokak", "Izmir", "Turkey", "23A", "35600");
                //---
                Customer customer3 = Customer.Create("First Name", "Last Name", 43, "12345ABCDE");

                House thirdHouse = House.Create("First house", "Description for the house", customer3);
                thirdHouse.AddAddress("333/1 Sokak", "Izmir", "Turkey", "23A", "35600");


                context.Customers.Add(customer);
                context.Customers.Add(customer2);
                context.Customers.Add(customer3);
                context.SaveChanges();
            }
        }
Exemplo n.º 3
0
        public void House_IsProperlyMapped()
        {
            using (DatabaseContext context = new DatabaseContext())
            {
                House house = DomainMocksFactory.CreateHouse();
                house.AddCategory("For Rent", "This house is for rent");
                house.AddAddress("My street", "my city", "my country", "my number", "zip code");

                context.Houses.Add(house);
                context.SaveChanges();
            }

            using (DatabaseContext context = new DatabaseContext())
            {
                House house = context.Houses
                              .Include("Category")
                              .Include("Address")
                              .FirstOrDefault();
                Assert.IsTrue(house.Name == DomainMocksFactory.HOUSE_NAME);
                Assert.IsTrue(house.Description == DomainMocksFactory.HOUSE_DESC);
                Assert.IsTrue(house.Address.Address1 == "My street");
            }
        }
Exemplo n.º 4
0
 public void Add_Address_To_House()
 {
     Assert.IsNull(mockHouse.Address);
     mockHouse.AddAddress("Address Line 1", "Izmir", "Turkey", "100/3", "35140");
     Assert.IsNotNull(mockHouse.Address);
 }