示例#1
0
        public LoginTO GetLastLogin()
        {
            var macAddress = GetMacAddress();
            var domain     = DefaultDAO.GetLastLogin(macAddress);

            return(Mapper.Map <LoginTO>(domain));
        }
        public void DeleteItemTest()
        {
            DefaultDAO _dao = new DefaultDAO(to.TestCasesStruct);

            //force equi class to load
            IList <EquivalenceClass> myAuxlist = new List <EquivalenceClass>();

            //two objects extracted from the database.
            Element element1 = to.TestCasesStruct.Elements[0];
            Element element2 = to.TestCasesStruct.Elements[1];

            for (int h = 0; h < element1.EquivalenceClasses.Count; h++)
            {
                EquivalenceClass eq = element1.EquivalenceClasses[h];
                myAuxlist.Add(eq);

                element1.RemoveEquivalenceClass(eq);
                h--;
            }

            for (int h = 0; h < element2.EquivalenceClasses.Count; h++)
            {
                EquivalenceClass eq = element2.EquivalenceClasses[h];
                myAuxlist.Add(eq);
                element2.RemoveEquivalenceClass(eq);
                h--;
            }
            to.TestCasesStruct.RemoveElement(element1);
            to.TestCasesStruct.RemoveElement(element2);

            _dao.Save(to);
        }
        public void Validate()
        {
            DefaultDAO  dao  = new DefaultDAO(to.TestCasesStruct);
            Dependency  dep  = new Dependency(to.TestCasesStruct);
            Combination com1 = new Combination(dep);
            Combination com2 = new Combination(dep);

            com1.Position = com2.Position;
            try
            {
                dao.Save();
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                dep.RemoveCombination(com1);
                dao.DeleteItem(com1);
                dep.RemoveCombination(com2);
                dao.DeleteItem(com2);
                to.TestCasesStruct.RemoveDependency(dep);

                dao.DeleteItem(dep);
            }
        }
示例#4
0
        public void DoCheckOut(long wipId)
        {
            var wip    = WipBO.Get(wipId);
            var domain = Mapper.Map <Wip.Domain.Wip>(wip);

            DefaultDAO.DoCheckIn(domain);
        }
示例#5
0
        public override long Save(RentalTO model)
        {
            Domain.Rental domain = null;

            if (model.Id != 0)
            {
                domain = DefaultDAO.Get(model.Id);
            }
            else
            {
                domain = new Domain.Rental();
            }

            Mapper.Map(model, domain);

            foreach (var item in domain.Movies.Where(a => model.MoviesId == null || !model.MoviesId.Contains(a.Id)).ToList())
            {
                domain.Movies.Remove(item);
            }

            if (model.MoviesId != null)
            {
                foreach (var item in model.MoviesId.Except(domain.Movies.Select(a => a.Id)).ToList())
                {
                    domain.Movies.Add(MovieDAO.GetReference(item));
                }
            }
            return(DefaultDAO.Save(domain));
        }
示例#6
0
        public StepTO Get(int stationType, int stepNumber)
        {
            var domain = DefaultDAO.Get(stepNumber);
            var stepTO = Mapper.Map <StepTO>(domain);

            stepTO.Procedures = Mapper.Map <ICollection <ProcedureTO> >(ProcedureDAO.ListByStep(stationType, stepTO.Number));
            return(stepTO);
        }
示例#7
0
        public StationTO Get(long stationNumber)
        {
            var domain  = DefaultDAO.Get(stationNumber);
            var station = Mapper.Map <StationTO>(domain);

            station.Steps = StepBO.ListByStation(station.Type, station.Number);
            return(station);
        }
        public void ICombinationsBean()
        {
            Dependency  dep         = new Dependency(to.TestCasesStruct);
            DefaultDAO  dao         = new DefaultDAO(to.TestCasesStruct);
            Combination combination = new Combination(dep);

            dao.Save();
            dep.RemoveCombination(combination);
            dao.DeleteItem(combination);
        }
 protected void setUp()
 {
     if (TestSetupClass.defaultTo == null)
     {
         TestSetupClass.RunBeforeAnyTests();
     }
     to   = TestSetupClass.defaultTo;
     dao1 = new TestObjectDAO();
     dao  = new DefaultDAO(to.TestCasesStruct);
 }
示例#10
0
        public void IExpectedResults()
        {
            Effect         effect = new Effect(to.TestCasesStruct);
            ExpectedResult res    = new ExpectedStringResult(effect, "Testing string");

            ExpectedNumberResult res2 = new ExpectedNumberResult(effect, 2000);

            DefaultDAO dao = new DefaultDAO(to.TestCasesStruct);

            dao.Save();
        }
示例#11
0
        public override MovieViewModel GetViewModel(long id)
        {
            var genders = Mapper.Map <IEnumerable <GenderTO> >(this.GenderDAO.GetAll());
            var movie   = (id == 0) ? new MovieTO() : Mapper.Map <MovieTO>(DefaultDAO.Get(id));

            return(new ViewModel.MovieViewModel
            {
                Genders = genders,
                Movie = movie
            });
        }
        public void IElementsBean()
        {
            DefaultDAO dao     = new DefaultDAO(to.TestCasesStruct);
            Dependency dep     = new Dependency(to.TestCasesStruct);
            Element    element = new Element(to.TestCasesStruct);

            dep.AddElement(element);
            dao.Save();
            to.TestCasesStruct.RemoveDependency(dep);
            dao.DeleteItem(dep);
        }
示例#13
0
        public ICollection <StepTO> ListByStation(int stationType, long stationNumber)
        {
            var domain  = DefaultDAO.ListByStation(stationNumber);
            var retList = Mapper.Map <ICollection <StepTO> >(domain);

            foreach (var step in retList)
            {
                var procedures = ProcedureDAO.ListByStep(stationType, step.Number);
                step.Procedures = Mapper.Map <ICollection <ProcedureTO> >(procedures);
            }
            return(retList);
        }
示例#14
0
        public void IRequirements()
        {
            DefaultDAO dao = new DefaultDAO(to.TestCasesStruct);

            Effect      effect = new Effect(to.TestCasesStruct);
            Requirement req    = new Requirement(to.TestCasesStruct, "Effect requirement");

            effect.AddRequirement(req);

            dao.Save();
            effect.RemoveRequirement(req);
            dao.Save();
        }
        public void Create()
        {
            User user = new User();

            user.Name     = "Sergio Moreno";
            user.UserName = "******";
            user.Password = "******";
            DefaultDAO dao = new DefaultDAO(user);

            dao.AddNew();
            user.Name = "Sergio Moreno Velez";
            dao.Save();
            dao.DeleteItem();
        }
示例#16
0
        public CustomerTO ValidateCustomer(CustomerTO model)
        {
            CustomerTO retObj   = null;
            var        criteria = Mapper.Map <CustomerCriteriaTO>(model);
            var        domain   = DefaultDAO.Search(criteria);

            if (domain.Any())
            {
                var domainCustomer = domain.First();
                var permissions    = GetPermissions(domainCustomer.RoleId);
                retObj             = Mapper.Map <CustomerTO>(domainCustomer);
                retObj.Permissions = permissions;
            }
            return(retObj);
        }
        public void IEffectsBean()
        {
            DefaultDAO  dao    = new DefaultDAO(to.TestCasesStruct);
            Dependency  dep    = new Dependency(to.TestCasesStruct);
            Combination combi  = new Combination(dep);
            Effect      effect = new Effect(to.TestCasesStruct);

            combi.AddEffect(effect);
            dao.Save();

            dep.RemoveCombination(combi);
            dao.DeleteItem(combi);
            to.TestCasesStruct.RemoveDependency(dep);
            dao.DeleteItem(dep);
            to.TestCasesStruct.RemoveEffect(effect);
            dao.DeleteItem(effect);
        }
示例#18
0
        public void WriteLogin(LoginTO loginTO)
        {
            var lastTO = GetLastLogin();

            loginTO.MacAddress = GetMacAddress();

            if (lastTO == null)
            {
                DefaultDAO.InsertLogin(loginTO);
            }
            else if (!loginTO.CompareLogin(lastTO))
            {
                DefaultDAO.DisableLogin(lastTO);

                DefaultDAO.InsertLogin(loginTO);
            }
        }
        public void ITestCasesBean()
        {
            DefaultDAO dao = new DefaultDAO(to.TestCasesStruct);

            StdCombination stdComb = new StdCombination(to.TestCasesStruct);
            TestCase       tc      = new TestCase(to.TestCasesStruct);

            stdComb.AddTestCase(tc);

            dao.Save();
            stdComb.RemoveTestCase(tc);
            to.TestCasesStruct.RemoveStdCombination(stdComb);
            dao.DeleteItem(stdComb);
            to.TestCasesStruct.RemoveTestCase(tc);
            dao.DeleteItem(tc);
            dao.Save();
        }
        public void IEquivalenceClassesBean()
        {
            StdCombination   st   = new StdCombination(to.TestCasesStruct);
            Element          elem = new Element(to.TestCasesStruct);
            EquivalenceClass equi = new EquivalenceClass(elem);

            st.AddEquivalenceClass(equi);
            DefaultDAO dao = new DefaultDAO(to.TestCasesStruct);

            dao.Save();
            st.RemoveEquivalenceClass(equi);
            elem.RemoveEquivalenceClass(equi);
            dao.DeleteItem(equi);
            to.TestCasesStruct.RemoveElement(elem);
            dao.DeleteItem(elem);
            to.TestCasesStruct.RemoveStdCombination(st);
            dao.DeleteItem(st);
        }
        public void ICombinationsBean()
        {
            TestCase    tc   = new TestCase(to.TestCasesStruct);
            DefaultDAO  dao  = new DefaultDAO(to.TestCasesStruct);
            Dependency  dep  = new Dependency(to.TestCasesStruct);
            Combination comb = new Combination(dep);

            tc.AddCombination(comb);
            dao.Save();
            Assert.IsNotNull(dao.GetItem(tc.GetType(), tc.Id));
            Assert.IsNotNull(dao.GetItem(comb.GetType(), comb.Id));
            tc.RemoveCombination(comb);
            dep.RemoveCombination(comb);
            dao.DeleteItem(comb);
            to.TestCasesStruct.RemoveTestCase(tc);
            dao.DeleteItem(tc);
            to.TestCasesStruct.RemoveDependency(dep);
            dao.DeleteItem(dep);
        }
        public void IEquivalenceClassesBean()
        {
            TestCase         tc               = new TestCase(to.TestCasesStruct);
            DefaultDAO       dao              = new DefaultDAO(to.TestCasesStruct);
            Element          elem             = new Element(to.TestCasesStruct);
            EquivalenceClass equivalenceClass = new EquivalenceClass(elem);

            tc.AddEquivalenceClass(equivalenceClass);
            dao.Save();
            Assert.IsNotNull(dao.GetItem(tc.GetType(), tc.Id));
            Assert.IsNotNull(dao.GetItem(equivalenceClass.GetType(), equivalenceClass.Id));
            tc.RemoveEquivalenceClass(equivalenceClass);
            elem.RemoveEquivalenceClass(equivalenceClass);
            dao.DeleteItem(equivalenceClass);
            to.TestCasesStruct.RemoveTestCase(tc);
            dao.DeleteItem(tc);
            to.TestCasesStruct.RemoveElement(elem);
            dao.DeleteItem(elem);
        }
        public void Validate()
        {
            TestCase   testcase   = new TestCase(to.TestCasesStruct);
            TestCase   testcase1  = new TestCase(to.TestCasesStruct);
            DefaultDAO elementDAO = new DefaultDAO(to.TestCasesStruct);

            testcase.Position = testcase1.Position;
            try
            {
                elementDAO.Save();
            }catch (Exception e)
            {
                throw e;
            }finally
            {
                to.TestCasesStruct.RemoveTestCase(testcase1);
                to.TestCasesStruct.RemoveTestCase(testcase);
            }
        }
        public void IEffectsBean()
        {
            Element          elem             = new Element(to.TestCasesStruct);
            EquivalenceClass equivalenceClass = new EquivalenceClass(elem);
            Effect           effect           = new Effect(to.TestCasesStruct);

            equivalenceClass.AddEffect(effect);
            DefaultDAO dao = new DefaultDAO(to.TestCasesStruct);

            dao.Save();
            Assert.IsNotNull(dao.GetItem(elem.GetType(), elem.Id));
            Assert.IsNotNull(dao.GetItem(equivalenceClass.GetType(), equivalenceClass.Id));
            Assert.IsNotNull(dao.GetItem(effect.GetType(), effect.Id));
            EquivalenceClass eq2 = dao.GetItem(equivalenceClass.GetType(), equivalenceClass.Id) as EquivalenceClass;

#pragma warning disable PossibleNullReferenceException
            Assert.IsTrue(eq2.Effects.Contains(effect));
#pragma warning restore PossibleNullReferenceException
        }
        public void CreatePermissions()
        {
            User user = new User();

            user.Name     = "Sergio Moreno";
            user.UserName = "******";
            user.Password = "******";
            DefaultDAO                   dao    = new DefaultDAO(user);
            TestObjectPermission         permi  = new TestObjectPermission(user, to);
            TestCasesStructurePermission permi2 = new TestCasesStructurePermission(user, to.TestCasesStruct);

            dao.Save();
            user.RemovePermission(permi);
            user.RemovePermission(permi2);
            to.RemovePermission(permi);
            to.TestCasesStruct.RemovePermission(permi2);
            dao.Save();
            dao.DeleteItem();
        }
示例#26
0
        public void IEquivalenceClassesBean()
        {
            // SessionManager.ReuseSession = false;
            Element    elem = new Element(to.TestCasesStruct);
            DefaultDAO dao  = new DefaultDAO(elem);

            EquivalenceClass equivalenceClass = new EquivalenceClass(elem);

            dao.AddNew();
            Assert.IsNotNull(dao.GetItem(elem.GetType(), elem.Id));
            Assert.IsNotNull(dao.GetItem(equivalenceClass.GetType(), equivalenceClass.Id));
            Element elem2 = dao.GetItem(elem.GetType(), elem.Id) as Element;

            //dao.Activate(elem2,"EquivalenceClasses");
            SessionManager.CurrentSession.Lock(elem2, LockMode.Read);
#pragma warning disable PossibleNullReferenceException
            Assert.IsTrue(elem2.EquivalenceClasses.Contains(equivalenceClass));
#pragma warning restore PossibleNullReferenceException
        }
示例#27
0
        public void Validate()
        {
            Element    element    = new Element(to.TestCasesStruct);
            DefaultDAO elementDAO = new DefaultDAO(element);
            Element    element1   = new Element(to.TestCasesStruct);

            element1.Name = element.Name;
            try
            {
                elementDAO.Save();
                elementDAO.Save(element1);
            }catch (Exception e)
            {
                throw e;
            }finally
            {
                to.TestCasesStruct.RemoveElement(element);
                to.TestCasesStruct.RemoveElement(element1);
            }
        }
        public void IEquivalenceClassBean()
        {
            DefaultDAO       dao   = new DefaultDAO(to.TestCasesStruct);
            Dependency       dep   = new Dependency(to.TestCasesStruct);
            Combination      combi = new Combination(dep);
            Element          elem  = new Element(to.TestCasesStruct);
            EquivalenceClass equiv = new EquivalenceClass(elem);

            combi.AddEquivalenceClass(equiv);
            dao.Save();

            dep.RemoveCombination(combi);
            dao.DeleteItem(combi);
            to.TestCasesStruct.RemoveDependency(dep);
            dao.DeleteItem(dep);
            elem.RemoveEquivalenceClass(equiv);
            dao.DeleteItem(equiv);
            to.TestCasesStruct.RemoveElement(elem);
            dao.DeleteItem(elem);
        }
        public void Validate()
        {
            DefaultDAO     elementDAO = new DefaultDAO(to.TestCasesStruct);
            StdCombination st1        = new StdCombination(to.TestCasesStruct);
            StdCombination st2        = new StdCombination(to.TestCasesStruct);

            st1.Position = st2.Position;
            try
            {
                elementDAO.Save();
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                to.TestCasesStruct.RemoveStdCombination(st1);
                to.TestCasesStruct.RemoveStdCombination(st2);
            }
        }
        public void CheckConstraints()
        {
            Element          element    = new Element(to.TestCasesStruct);
            DefaultDAO       elementDAO = new DefaultDAO(element);
            EquivalenceClass eq1        = new EquivalenceClass(element);
            EquivalenceClass eq2        = new EquivalenceClass(element);

            //this must throw an exception in the save (same position two equivalence classes)
            eq2.Position = eq1.Position;
            try
            {
                elementDAO.Save();
            }catch (Exception e)
            {
                throw e;
            }finally
            {
                element.RemoveEquivalenceClass(eq1);
                element.RemoveEquivalenceClass(eq2);
                to.TestCasesStruct.RemoveElement(element);
            }
        }