コード例 #1
0
        public void UpdateFactoryByIdTest()
        {
            Factory    factory = CreateFactory();
            FactoryDAO dao     = new FactoryDAO();
            bool       insert  = dao.InsertFactory(factory);

            Base basPom = new Base();

            basPom.Planet = "Mars";
            BaseDAO baseDAO = new BaseDAO();

            baseDAO.InsertBase(basPom);
            factory.BaseId     = bas.BaseId;
            factory.CargoCount = 40;
            factory.Type       = "služby";

            dao.UpdateFactoryById(factory);

            Factory factoryPom = dao.GetFactoryById(factory.FacotryId);

            Assert.IsTrue(factoryPom.BaseId == bas.BaseId && factoryPom.CargoCount == 40 && factoryPom.Type == "služby");

            dao.RemoveFactoryById(factory.FacotryId);
            baseDAO.RemoveBaseById(basPom.BaseId);
        }
コード例 #2
0
        public void GetFactoriesByTypeTest()
        {
            Factory    factory = CreateFactory();
            FactoryDAO dao     = new FactoryDAO();
            bool       insert  = dao.InsertFactory(factory);
            int        firstId = factory.FacotryId;

            factory.Type = "služby";
            dao.InsertFactory(factory);

            List <Factory> factoryPom = dao.GetFactoriesByType("zboží");

            Assert.IsTrue(factoryPom.Count == 1);

            dao.RemoveFactoryById(factory.FacotryId);
            dao.RemoveFactoryById(firstId);
        }
コード例 #3
0
        public void InsertFactoryTest()
        {
            Factory    factory = CreateFactory();
            FactoryDAO dao     = new FactoryDAO();
            bool       insert  = dao.InsertFactory(factory);

            Assert.IsTrue(insert);
            dao.RemoveFactoryById(factory.FacotryId);
        }
コード例 #4
0
        public void GetFactoriesTest()
        {
            Factory    factory = CreateFactory();
            FactoryDAO dao     = new FactoryDAO();
            bool       insert  = dao.InsertFactory(factory);

            List <Factory> factoryPom = dao.GetFactories();

            Assert.IsTrue(factoryPom.Count == 1);
        }
コード例 #5
0
        public void GetFactoryByIdTest()
        {
            Factory    factory = CreateFactory();
            FactoryDAO dao     = new FactoryDAO();
            bool       insert  = dao.InsertFactory(factory);

            Factory factoryPom = dao.GetFactoryById(factory.FacotryId);

            Assert.IsTrue(factory.FacotryId == factoryPom.FacotryId && factory.BaseId == factoryPom.BaseId);

            dao.RemoveFactoryById(factory.FacotryId);
        }
コード例 #6
0
        public void RemoveFactoryByIdTest()
        {
            Factory    factory = CreateFactory();
            FactoryDAO dao     = new FactoryDAO();
            bool       insert  = dao.InsertFactory(factory);

            dao.RemoveFactoryById(factory.FacotryId);

            Factory factoryPom = dao.GetFactoryById(factory.FacotryId);

            Assert.IsNull(factoryPom);
        }
コード例 #7
0
        public void GetFactoriesByPlanetTest()
        {
            Factory    factory = CreateFactory();
            FactoryDAO dao     = new FactoryDAO();
            bool       insert  = dao.InsertFactory(factory);
            int        firstId = factory.FacotryId;
            Base       basPom  = new Base();

            basPom.Planet = "Mars";
            BaseDAO baseDAO = new BaseDAO();

            baseDAO.InsertBase(basPom);
            factory.BaseId = basPom.BaseId;

            dao.InsertFactory(factory);

            List <Factory> factoryPom = dao.GetFactoriesByPlanet("Země");

            Assert.IsTrue(factoryPom.Count == 1);

            dao.RemoveFactoryById(factory.FacotryId);
            dao.RemoveFactoryById(firstId);
            baseDAO.RemoveBaseById(basPom.BaseId);
        }