Exemplo n.º 1
0
        public void TestHierarchyMove()
        {
            using (var context = new ScenarioGeneratorModel(UserName, Connection))
            {
                context.Database.Log = s => System.Diagnostics.Debug.WriteLine(s);

                var repository = new CurveFamillyRepository(context);

                var parent = context.CurveFamilies.Single(x => x.Name=="LBG");
                var child = parent.CurveFamilyChildren.First();

                var newParent = repository.Add(parent);
                newParent.Name = "New Curve Familly Parent";
                repository.SaveChanges();

                Assert.IsTrue(repository.Move(child, newParent));
                Assert.AreEqual(child.CurveFamilyParent.Name, newParent.Name);

                repository.SaveChanges();

                var saved = context.CurveFamilies.Single(x => x.Name == "New Curve Familly Parent");

                Assert.IsTrue(saved.CurveFamilyChildren.Count > 0);
            }
        }
Exemplo n.º 2
0
        public void TestApproval()
        {
            using (var context = new ScenarioGeneratorModel(UserName, Connection))
            {
                context.Database.Log = s => System.Diagnostics.Debug.WriteLine(s);

                var repository = new CurveFamillyRepository(context);

                var parent = context.CurveFamilies.Single(x => x.Name == "LBG");

                var newChild = repository.Add(parent);
                newChild.Name = "New Curve Child";
                repository.SaveChanges();

                var saved = context.CurveFamilies.Single(x => x.Name == "New Curve Child");

                Assert.AreEqual(EntityStatus.ApprovedInSession, saved.Status);
                repository.SaveChanges();
                saved = context.CurveFamilies.Single(x => x.Name == "New Curve Child");
                Assert.AreEqual(context.UserName, saved.ApprovedBy);
            }
        }