Exemplo n.º 1
0
        public void House_Can_Create_NewCategory()
        {
            Assert.IsNull(mockHouse.Category);

            mockHouse.AddCategory("rent", "house for rent");
            Assert.IsNotNull(mockHouse.Category);
        }
Exemplo n.º 2
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.º 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");
            }
        }