Exemplo n.º 1
0
        public void AddInvalidHouseTest()
        {
            var newHouse = TestHelper.GetHouse();

            //Delete all rooms from the house to make it invalid
            newHouse.Room.Clear();

            var gatewayHouse = default(House);

            using (var gateway = new SimpleGatewayImpl())
            {
                try
                {
                    gatewayHouse = (House)gateway.Create(new CreateMessage(newHouse));
                }
                catch (Exception ex)
                {
                    Assert.Fail(ex.Message);
                }
            }

            Assert.AreSame(newHouse, gatewayHouse);

            using (var db = new TweakTestDataEntities())
            {
                Assert.IsNotNull(db.HouseSet.ToList().FirstOrDefault(house => house.Address.Equals(newHouse.Address)));
            }
        }
Exemplo n.º 2
0
        public void AddInvalidHouseTest()
        {
            var newHouse = TestHelper.GetHouse();

            //Delete all rooms from the house to make it invalid
            newHouse.Room.Clear();

            var gatewayHouse = default(House);

            using (var gateway = new SimpleGatewayImpl())
            {
                try
                {
                    gatewayHouse = (House)gateway.Create(new CreateMessage(newHouse));
                }
                catch (Exception ex)
                {
                    Assert.Fail(ex.Message);
                }
            }

            Assert.AreSame(newHouse, gatewayHouse);

            using (var db = new TweakTestDataEntities())
            {
                Assert.IsNotNull(db.HouseSet.ToList().FirstOrDefault(house => house.Address.Equals(newHouse.Address)));
            }
        }
Exemplo n.º 3
0
 public void ResetDatabase()
 {
     using (var db = new TweakTestDataEntities())
     {
         db.Database.Delete();
         db.SaveChanges();
         db.Database.Create();
         db.SaveChanges();
     }
 }
Exemplo n.º 4
0
        public static GatewayStrategy Resolve(TweakTestDataEntities db, CreateMessage message)
        {
            var item = message.Item;

            if (item is House)
            {
                return(new CreateHouseStrategy(db));
            }
            return(null);
        }
Exemplo n.º 5
0
 public void ResetDatabase()
 {
     using (var db = new TweakTestDataEntities())
     {
         db.Database.Delete();
         db.SaveChanges();
         db.Database.Create();
         db.SaveChanges();
     }
 }
Exemplo n.º 6
0
        public static GatewayStrategy Resolve(TweakTestDataEntities db, CreateMessage message)
        {
            var item = message.Item;

            if (item is House)
            {
                return new CreateHouseStrategy(db);
            }
            return null;
        }
Exemplo n.º 7
0
 public CreateHouseStrategy(TweakTestDataEntities db)
 {
     Db = db;
 }
Exemplo n.º 8
0
 public CreateHouseStrategy(TweakTestDataEntities db)
 {
     Db = db;
 }