public void Sort()
        {
            var x = new C1Builder(this.Session).Build();
            var y = new C1Builder(this.Session).Build();
            var z = new C1Builder(this.Session).Build();

            x.AddDependency(y);
            y.AddDependency(z);

            var derivation = this.DerivationService.CreateDerivation(this.Session);

            var sequence = new List <IObject>();

            derivation["sequence"] = sequence;

            derivation.Derive();

            Assert.Equal(z, sequence[0]);
            Assert.Equal(y, sequence[1]);
            Assert.Equal(x, sequence[2]);

            Assert.Equal(1, x.DerivationCount);
            Assert.Equal(1, y.DerivationCount);
            Assert.Equal(1, z.DerivationCount);
        }
예제 #2
0
파일: PathTests.cs 프로젝트: whesius/allors
        public void One2Many()
        {
            var c2A = new C2Builder(this.DatabaseSession).WithC2AllorsString("c2A").Build();
            var c2B = new C2Builder(this.DatabaseSession).WithC2AllorsString("c2B").Build();
            var c2C = new C2Builder(this.DatabaseSession).WithC2AllorsString("c2C").Build();

            var c1a = new C1Builder(this.DatabaseSession)
                .WithC1AllorsString("c1A")
                .WithC1C2One2Many(c2A)
                .Build();

            var c1b = new C1Builder(this.DatabaseSession)
                .WithC1AllorsString("c1B")
                .WithC1C2One2Many(c2B)
                .WithC1C2One2Many(c2C)
                .Build();

            this.DatabaseSession.Derive(true);

            var path = new Path(C1s.Meta.C1C2One2Manies, C2s.Meta.C2AllorsString);

            var aclMock = new Mock<IAccessControlList>();
            aclMock.Setup(acl => acl.CanRead(It.IsAny<PropertyType>())).Returns(true);
            var acls = new AccessControlListCache(null, (allorsObject, user) => aclMock.Object);

            var result = (ISet<object>)path.Get(c1a, acls);
            Assert.AreEqual(1, result.Count);
            Assert.IsTrue(result.Contains("c2A"));

            result = (ISet<object>)path.Get(c1b, acls);
            Assert.AreEqual(2, result.Count);
            Assert.IsTrue(result.Contains("c2B"));
            Assert.IsTrue(result.Contains("c2C"));
        }
예제 #3
0
        public void One2ManyWithPropertyNames()
        {
            var c2A = new C2Builder(this.Session).WithC2AllorsString("c2A").Build();
            var c2B = new C2Builder(this.Session).WithC2AllorsString("c2B").Build();
            var c2C = new C2Builder(this.Session).WithC2AllorsString("c2C").Build();

            var c1A = new C1Builder(this.Session)
                      .WithC1AllorsString("c1A")
                      .WithC1C2One2Many(c2A)
                      .Build();

            var c1B = new C1Builder(this.Session)
                      .WithC1AllorsString("c1B")
                      .WithC1C2One2Many(c2B)
                      .WithC1C2One2Many(c2C)
                      .Build();

            this.Session.Derive();

            Fetch.TryParse(M.C2.ObjectType, "C1WhereC1C2One2Many", out var fetch);

            var result = (C1)fetch.Get(c2A, this.AclsMock.Object);

            Assert.Equal(result, c1A);

            result = (C1)fetch.Get(c2B, this.AclsMock.Object);
            Assert.Equal(result, c1B);
        }
        public void SortDiamond()
        {
            var a = new C1Builder(this.Session).WithName("a").Build();
            var b = new C1Builder(this.Session).WithName("b").Build();
            var c = new C1Builder(this.Session).WithName("c").Build();
            var d = new C1Builder(this.Session).WithName("d").Build();

            a.AddDependency(b);
            a.AddDependency(c);

            b.AddDependency(d);
            c.AddDependency(d);

            var derivation = this.DerivationService.CreateDerivation(this.Session);

            var sequence = new List <IObject>();

            derivation["sequence"] = sequence;

            derivation.Derive();

            Assert.Equal(d, sequence[0]);
            Assert.Equal(a, sequence[3]);

            Assert.Equal(1, a.DerivationCount);
            Assert.Equal(1, b.DerivationCount);
            Assert.Equal(1, c.DerivationCount);
            Assert.Equal(1, d.DerivationCount);
        }
예제 #5
0
파일: TreeTests.cs 프로젝트: lulzzz/allors2
        public void Resolve()
        {
            var c2A = new C2Builder(this.Session).WithC2AllorsString("c2A").Build();
            var c2B = new C2Builder(this.Session).WithC2AllorsString("c2B").Build();
            var c2C = new C2Builder(this.Session).WithC2AllorsString("c2C").Build();

            var c1A = new C1Builder(this.Session).WithC1AllorsString("c1A").WithC1C2One2Many(c2A).Build();

            var c1B =
                new C1Builder(this.Session).WithC1AllorsString("c1B")
                .WithC1C2One2Many(c2B)
                .WithC1C2One2Many(c2C)
                .Build();

            this.Session.Derive(true);

            var tree = new Tree(M.C1.ObjectType).Add(M.C1.C1C2One2Manies);

            var resolved = new HashSet <IObject>();

            tree.Resolve(c1A, resolved);

            Assert.Equal(1, resolved.Count);
            Assert.Contains(c2A, resolved);

            resolved = new HashSet <IObject>();
            tree.Resolve(c1B, resolved);

            Assert.Equal(2, resolved.Count);
            Assert.Contains(c2B, resolved);
            Assert.Contains(c2C, resolved);
        }
예제 #6
0
        public void Resolve()
        {
            var c2A = new C2Builder(this.Session).WithC2AllorsString("c2A").Build();
            var c2B = new C2Builder(this.Session).WithC2AllorsString("c2B").Build();
            var c2C = new C2Builder(this.Session).WithC2AllorsString("c2C").Build();

            var c1A = new C1Builder(this.Session).WithC1AllorsString("c1A").WithC1C2One2Many(c2A).Build();

            var c1B = new C1Builder(this.Session).WithC1AllorsString("c1B")
                      .WithC1C2One2Many(c2B)
                      .WithC1C2One2Many(c2C)
                      .Build();

            this.Session.Derive();

            var tree = new[] { new Node(M.C1.C1C2One2Manies) };

            var resolved = new HashSet <IObject>();

            tree.Resolve(c1A, this.AclsMock.Object, resolved);

            Assert.Single(resolved);
            Assert.Contains(c2A, resolved);

            resolved = new HashSet <IObject>();
            tree.Resolve(c1B, this.AclsMock.Object, resolved);

            Assert.Equal(2, resolved.Count);
            Assert.Contains(c2B, resolved);
            Assert.Contains(c2C, resolved);
        }
예제 #7
0
        public void Sort()
        {
            var x = new C1Builder(this.Session).Build();
            var y = new C1Builder(this.Session).Build();
            var z = new C1Builder(this.Session).Build();

            x.AddDependency(y);
            y.AddDependency(z);

            var derivation = new Derivation(this.Session, new DerivationConfig {
                ThrowExceptionOnCycleDetected = true
            });

            var sequence = new List <IObject>();

            derivation["sequence"] = sequence;

            derivation.Derive();

            Assert.Equal(z, sequence[0]);
            Assert.Equal(y, sequence[1]);
            Assert.Equal(x, sequence[2]);

            Assert.Equal(1, x.DerivationCount);
            Assert.Equal(1, y.DerivationCount);
            Assert.Equal(1, z.DerivationCount);
        }
예제 #8
0
        public void SortDiamond()
        {
            var a = new C1Builder(this.Session).Build();
            var b = new C1Builder(this.Session).Build();
            var c = new C1Builder(this.Session).Build();
            var d = new C1Builder(this.Session).Build();

            a.AddDependency(b);
            a.AddDependency(c);

            b.AddDependency(d);
            c.AddDependency(d);

            var derivation = new Derivation(this.Session, new DerivationConfig {
                ThrowExceptionOnCycleDetected = true
            });

            var sequence = new List <IObject>();

            derivation["sequence"] = sequence;

            derivation.Derive();

            Assert.Equal(d, sequence[0]);
            Assert.Equal(a, sequence[3]);

            Assert.Equal(1, a.DerivationCount);
            Assert.Equal(1, b.DerivationCount);
            Assert.Equal(1, c.DerivationCount);
            Assert.Equal(1, d.DerivationCount);
        }
예제 #9
0
파일: PathTests.cs 프로젝트: whesius/allors
        public void One2ManyWithPropertyNames()
        {
            var c2A = new C2Builder(this.Session).WithC2AllorsString("c2A").Build();
            var c2B = new C2Builder(this.Session).WithC2AllorsString("c2B").Build();
            var c2C = new C2Builder(this.Session).WithC2AllorsString("c2C").Build();

            var c1A = new C1Builder(this.Session)
                .WithC1AllorsString("c1A")
                .WithC1C2One2Many(c2A)
                .Build();

            var c1B = new C1Builder(this.Session)
                .WithC1AllorsString("c1B")
                .WithC1C2One2Many(c2B)
                .WithC1C2One2Many(c2C)
                .Build();

            this.Session.Derive(true);

            Path path;
            Path.TryParse(C2.Meta.ObjectType, "C2One2ManyC1", out path);

            var aclMock = new Mock<IAccessControlList>();
            aclMock.Setup(acl => acl.CanRead(It.IsAny<PropertyType>())).Returns(true);
            var acls = new AccessControlListCache(null, (allorsObject, user) => aclMock.Object);

            var result = (C1)path.Get(c2A, acls);
            Assert.AreEqual(result, c1A);

            result = (C1)path.Get(c2B, acls);
            Assert.AreEqual(result, c1B);
        }
예제 #10
0
        public void One2ManyWithPropertyNames()
        {
            var c2A = new C2Builder(this.Session).WithC2AllorsString("c2A").Build();
            var c2B = new C2Builder(this.Session).WithC2AllorsString("c2B").Build();
            var c2C = new C2Builder(this.Session).WithC2AllorsString("c2C").Build();

            var c1A = new C1Builder(this.Session)
                      .WithC1AllorsString("c1A")
                      .WithC1C2One2Many(c2A)
                      .Build();

            var c1B = new C1Builder(this.Session)
                      .WithC1AllorsString("c1B")
                      .WithC1C2One2Many(c2B)
                      .WithC1C2One2Many(c2C)
                      .Build();

            this.Session.Derive(true);

            Path path;

            Path.TryParse(M.C2.ObjectType, "C1WhereC1C2One2Many", out path);

            var aclMock = new Mock <IAccessControlList>();

            aclMock.Setup(acl => acl.CanRead(It.IsAny <PropertyType>())).Returns(true);
            var acls = new AccessControlListCache(null, (allorsObject, user) => aclMock.Object);

            var result = (C1)path.Get(c2A, acls);

            Assert.AreEqual(result, c1A);

            result = (C1)path.Get(c2B, acls);
            Assert.AreEqual(result, c1B);
        }
예제 #11
0
        public void One2ManyWithPropertyTypeIds()
        {
            var c2A = new C2Builder(this.Session).WithC2AllorsString("c2A").Build();
            var c2B = new C2Builder(this.Session).WithC2AllorsString("c2B").Build();
            var c2C = new C2Builder(this.Session).WithC2AllorsString("c2C").Build();

            var c1a = new C1Builder(this.Session)
                      .WithC1AllorsString("c1A")
                      .WithC1C2One2Many(c2A)
                      .Build();

            var c1b = new C1Builder(this.Session)
                      .WithC1AllorsString("c1B")
                      .WithC1C2One2Many(c2B)
                      .WithC1C2One2Many(c2C)
                      .Build();

            this.Session.Derive();

            var path = new Fetch(MetaC1.Instance.C1C2One2Manies, MetaC2.Instance.C2AllorsString);

            var result = (ISet <object>)path.Get(c1a, this.AclsMock.Object);

            Assert.Equal(1, result.Count);
            Assert.True(result.Contains("c2A"));

            result = (ISet <object>)path.Get(c1b, this.AclsMock.Object);
            Assert.Equal(2, result.Count);
            Assert.True(result.Contains("c2B"));
            Assert.True(result.Contains("c2C"));
        }
예제 #12
0
        public void ClassMethod()
        {
            var c1 = new C1Builder(this.Session).Build();

            var classMethod = c1.ClassMethod();

            Assert.AreEqual("C1TestC1BaseC1Core", classMethod.Value);
        }
예제 #13
0
        public void ClassMethod()
        {
            var c1 = new C1Builder(this.Session).Build();

            var classMethod = c1.ClassMethod();

            Assert.Equal("C1CustomC1BaseC1Core", classMethod.Value);
        }
예제 #14
0
        public void ResolveMultipleSubtree()
        {
            var c1A = new C1Builder(this.Session).WithC1AllorsString("c1A").Build();
            var c1B = new C1Builder(this.Session).WithC1AllorsString("c1B").Build();
            var c1C = new C1Builder(this.Session).WithC1AllorsString("c1C").Build();
            var c1D = new C1Builder(this.Session).WithC1AllorsString("c1D").Build();
            var c1E = new C1Builder(this.Session).WithC1AllorsString("c1E").Build();

            var c2A = new C2Builder(this.Session).WithC2AllorsString("c2A").Build();
            var c2B = new C2Builder(this.Session).WithC2AllorsString("c2B").Build();
            var c2C = new C2Builder(this.Session).WithC2AllorsString("c2C").Build();
            var c2D = new C2Builder(this.Session).WithC2AllorsString("c2D").Build();

            c1A.AddC1I12One2Many(c1C);
            c1B.AddC1I12One2Many(c1E);
            c1B.AddC1I12One2Many(c2A);
            c1B.AddC1I12One2Many(c2B);

            c1C.AddC1C1One2Many(c1D);
            c2A.AddC2C2One2Many(c2C);
            c2A.AddC2C2One2Many(c2D);

            this.Session.Derive();

            this.Session.Commit();

            var tree = new[]
            {
                new Node(M.C1.C1I12One2Manies)
                .Add(M.C1.C1C1One2Manies),
                new Node(M.C1.C1I12One2Manies)
                .Add(M.C2.C2C2One2Manies),
            };

            var prefetchPolicy = tree.BuildPrefetchPolicy();

            var resolved = new HashSet <IObject>();

            this.Session.Prefetch(prefetchPolicy, c1A);

            tree.Resolve(c1A, this.AclsMock.Object, resolved);

            Assert.Equal(2, resolved.Count);
            Assert.Contains(c1C, resolved);
            Assert.Contains(c1D, resolved);

            resolved = new HashSet <IObject>();

            this.Session.Prefetch(prefetchPolicy, c1B);
            tree.Resolve(c1B, this.AclsMock.Object, resolved);

            Assert.Equal(5, resolved.Count);
            Assert.Contains(c1E, resolved);
            Assert.Contains(c2A, resolved);
            Assert.Contains(c2B, resolved);
            Assert.Contains(c2C, resolved);
            Assert.Contains(c2D, resolved);
        }
예제 #15
0
        public void InterfaceMethod()
        {
            var c1 = new C1Builder(this.Session)
                     .Build();

            var interfaceMethod = c1.InterfaceMethod();

            Assert.Equal("I1CustomI1CoreC1CustomC1Core", interfaceMethod.Value);
        }
예제 #16
0
        public void SuperinterfaceMethod()
        {
            var c1 = new C1Builder(this.Session)
                     .Build();

            var interfaceMethod = c1.SuperinterfaceMethod();

            Assert.Equal("S1CustomS1BaseS1CoreI1CustomI1BaseI1CoreC1CustomC1BaseC1Core", interfaceMethod.Value);
        }
예제 #17
0
        public void InterfaceMethod()
        {
            var c1 = new C1Builder(this.Session)
                .Build();

            var interfaceMethod = c1.InterfaceMethod();

            Assert.AreEqual("I1TestI1BaseI1CoreC1TestC1BaseC1Core", interfaceMethod.Value);
        }
예제 #18
0
        public void ResolveMultipleSubtree()
        {
            var c1A = new C1Builder(this.Session).WithC1AllorsString("c1A").Build();
            var c1B = new C1Builder(this.Session).WithC1AllorsString("c1B").Build();
            var c1C = new C1Builder(this.Session).WithC1AllorsString("c1C").Build();
            var c1D = new C1Builder(this.Session).WithC1AllorsString("c1D").Build();
            var c1E = new C1Builder(this.Session).WithC1AllorsString("c1E").Build();

            var c2A = new C2Builder(this.Session).WithC2AllorsString("c2A").Build();
            var c2B = new C2Builder(this.Session).WithC2AllorsString("c2B").Build();
            var c2C = new C2Builder(this.Session).WithC2AllorsString("c2C").Build();
            var c2D = new C2Builder(this.Session).WithC2AllorsString("c2D").Build();

            c1A.AddC1I12One2Many(c1C);
            c1B.AddC1I12One2Many(c1E);
            c1B.AddC1I12One2Many(c2A);
            c1B.AddC1I12One2Many(c2B);

            c1C.AddC1C1One2Many(c1D);
            c2A.AddC2C2One2Many(c2C);
            c2A.AddC2C2One2Many(c2D);

            this.Session.Derive(true);

            this.Session.Commit();

            var tree =
                new Tree(M.C1.ObjectType)
                .Add(M.C1.C1I12One2Manies,
                     new Tree(M.C1.ObjectType).Add(M.C1.C1C1One2Manies))
                .Add(M.C1.C1I12One2Manies,
                     new Tree(M.C2.ObjectType).Add(M.C2.C2C2One2Manies));

            var prefetchPolicy = tree.BuildPrefetechPolicy();

            var resolved = new HashSet <IObject>();

            this.Session.Prefetch(prefetchPolicy, c1A);
            tree.Resolve(c1A, resolved);

            resolved.Count.ShouldEqual(2);
            resolved.ShouldContain(c1C);
            resolved.ShouldContain(c1D);

            resolved = new HashSet <IObject>();

            this.Session.Prefetch(prefetchPolicy, c1B);
            tree.Resolve(c1B, resolved);

            resolved.Count.ShouldEqual(5);
            resolved.ShouldContain(c1E);
            resolved.ShouldContain(c2A);
            resolved.ShouldContain(c2B);
            resolved.ShouldContain(c2C);
            resolved.ShouldContain(c2D);
        }
예제 #19
0
        public void AdministratorRemoveMany()
        {
            // Arrange
            var administrator = new People(this.Session).FindBy(M.Person.UserName, Users.AdministratorUserName);

            var c1a = new C1Builder(this.Session)
                      .Build();

            var c1b = new C1Builder(this.Session)
                      .Build();

            var c1c = new C1Builder(this.Session)
                      .Build();

            c1a.AddC1C1One2Many(c1b);
            c1a.AddC1C1One2Many(c1c);

            this.Session.Derive();
            this.Session.Commit();

            var saveRequest = new PushRequest
            {
                Objects = new[] {
                    new PushRequestObject
                    {
                        I     = c1a.Id.ToString(),
                        V     = c1a.Strategy.ObjectVersion.ToString(),
                        Roles = new List <PushRequestRole>
                        {
                            new PushRequestRole
                            {
                                T = "C1C1One2Many",
                                R = new [] { c1c.Id.ToString() }
                            }
                        }
                    }
                }
            };

            var controller = new DatabaseController {
                AllorsSession = this.Session, AllorsUser = administrator
            };

            // Act
            var jsonResult   = (JsonResult)controller.Push(saveRequest);
            var saveResponse = (PushResponse)jsonResult.Data;

            // Assert
            this.Session.Rollback();

            saveResponse.HasErrors.ShouldBeFalse();

            c1a.C1C1One2Manies.ShouldNotBeSameAs(new[] { c1b });
        }
예제 #20
0
파일: SaveTests.cs 프로젝트: whesius/allors
        public void AdministratorRemoveMany()
        {
            // Arrange
            var administrator = new Persons(this.Session).FindBy(Persons.Meta.UserName, Users.AdministratorUserName);

            var c1a = new C1Builder(this.Session)
               .Build();

            var c1b = new C1Builder(this.Session)
               .Build();

            var c1c = new C1Builder(this.Session)
               .Build();

            c1a.AddC1C1One2Many(c1b);
            c1a.AddC1C1One2Many(c1c);

            this.Session.Derive();
            this.Session.Commit();

            var saveRequest = new SaveRequest
            {
                Objects = new[] {
                    new SaveRequestObject
                    {
                        I = c1a.Id.ToString(),
                        V = c1a.Strategy.ObjectVersion.ToString(),
                        Roles = new List<SaveRequestRole>
                        {
                            new SaveRequestRole
                            {
                                T = "C1C1One2Many",
                                R = new [] { c1c.Id.ToString() }
                            }
                        }
                    }
                }
            };

            var controller = new AngularController { AllorsSession = this.Session, AuthenticatedUser = administrator };

            // Act
            var jsonResult = (JsonResult)controller.Save(saveRequest);
            var saveResponse = (SaveResponse)jsonResult.Data;

            // Assert
            this.Session.Rollback();

            saveResponse.Errors.Count.ShouldEqual(0);

            c1a.C1C1One2Manies.ShouldNotBeSameAs(new[] { c1b });
        }
예제 #21
0
        public void MethodWithResults()
        {
            var c1 = new C1Builder(this.Session).Build();

            var method = c1.Sum(
                m =>
                {
                    m.a = 1;
                    m.b = 2;
                });

            Assert.AreEqual(3, method.result);
        }
예제 #22
0
        public void MethodWithResults()
        {
            var c1 = new C1Builder(this.Session).Build();

            var method = c1.Sum(
                m =>
            {
                m.a = 1;
                m.b = 2;
            });

            Assert.Equal(3, method.result);
        }
예제 #23
0
        public void MarkAsModified()
        {
            var first = new C1Builder(this.Session).Build();

            this.Session.Commit();

            Assert.Equal(0, first.DerivationCount);

            var derivation = new Derivation(this.Session);

            derivation.MarkAsModified(first);
            derivation.Derive();

            Assert.Equal(1, first.DerivationCount);
        }
예제 #24
0
        public void AdministratorSetUnit()
        {
            // Arrange
            var administrator = new People(this.Session).FindBy(M.Person.UserName, Users.AdministratorUserName);

            var c1a = new C1Builder(this.Session)
                      .WithC1AllorsString("c1")
                      .WithI1AllorsString("i1")
                      .WithI12AllorsString("i12")
                      .Build();

            this.Session.Derive();
            this.Session.Commit();

            var pushRequest = new PushRequest
            {
                Objects = new[] {
                    new PushRequestObject
                    {
                        I     = c1a.Id.ToString(),
                        V     = c1a.Strategy.ObjectVersion.ToString(),
                        Roles = new List <PushRequestRole>
                        {
                            new PushRequestRole
                            {
                                T = "C1AllorsString",
                                S = "new c1"
                            }
                        }
                    }
                }
            };

            var controller = new DatabaseController {
                AllorsSession = this.Session, AllorsUser = administrator
            };

            // Act
            var jsonResult   = (JsonResult)controller.Push(pushRequest);
            var pushResponse = (PushResponse)jsonResult.Data;

            // Assert
            this.Session.Rollback();

            pushResponse.HasErrors.ShouldBeFalse();

            c1a.C1AllorsString.ShouldEqual("new c1");
        }
예제 #25
0
        public void GuestSetUnit()
        {
            // Arrange
            var c1a = new C1Builder(this.Session)
                      .WithC1AllorsString("c1")
                      .WithI1AllorsString("i1")
                      .WithI12AllorsString("i12")
                      .Build();

            this.Session.Derive();
            this.Session.Commit();

            var pushRequest = new PushRequest
            {
                Objects = new[] {
                    new PushRequestObject
                    {
                        I     = c1a.Id.ToString(),
                        V     = c1a.Strategy.ObjectVersion.ToString(),
                        Roles = new List <PushRequestRole>
                        {
                            new PushRequestRole
                            {
                                T = "C1AllorsString",
                                S = "new c1"
                            }
                        }
                    }
                }
            };

            var controller = new DatabaseController {
                AllorsSession = this.Session
            };

            // Act
            var jsonResult   = (JsonResult)controller.Push(pushRequest);
            var pushResponse = (PushResponse)jsonResult.Data;

            // Assert
            this.Session.Rollback();

            pushResponse.HasErrors.ShouldBeTrue();
            pushResponse.AccessErrors.Count.ShouldEqual(1);

            c1a.C1AllorsString.ShouldEqual("c1");
        }
예제 #26
0
        public void CallMethodTwice()
        {
            var c1 = new C1Builder(this.Session)
                .Build();

            var classMethod = c1.ClassMethod();

            var exceptionThrown = false;
            try
            {
                classMethod.Execute();
            }
            catch
            {
                exceptionThrown = true;
            }

            Assert.IsTrue(exceptionThrown);
        }
예제 #27
0
        public void Sort()
        {
            var x = new C1Builder(this.DatabaseSession).Build();
            var y = new C1Builder(this.DatabaseSession).Build();
            var z = new C1Builder(this.DatabaseSession).Build();

            x.AddDependency(y);
            y.AddDependency(z);

            var derivation = new Derivation(this.DatabaseSession);

            var sequence = new List<IObject>();
            derivation["sequence"] = sequence;

            derivation.Derive();

            Assert.AreEqual(z, sequence[0]);
            Assert.AreEqual(y, sequence[1]);
            Assert.AreEqual(x, sequence[2]);
        }
예제 #28
0
        public void CallMethodTwice()
        {
            var c1 = new C1Builder(this.Session)
                     .Build();

            var classMethod = c1.ClassMethod();

            var exceptionThrown = false;

            try
            {
                classMethod.Execute();
            }
            catch
            {
                exceptionThrown = true;
            }

            Assert.True(exceptionThrown);
        }
        public void Sort()
        {
            var x = new C1Builder(this.Session).Build();
            var y = new C1Builder(this.Session).Build();
            var z = new C1Builder(this.Session).Build();

            x.AddDependency(y);
            y.AddDependency(z);

            var derivation = new Derivation(this.Session);

            var sequence = new List <IObject>();

            derivation["sequence"] = sequence;

            derivation.Derive();

            Assert.AreEqual(z, sequence[0]);
            Assert.AreEqual(y, sequence[1]);
            Assert.AreEqual(x, sequence[2]);
        }
예제 #30
0
파일: LoadTests.cs 프로젝트: whesius/allors
        public void Administrator()
        {
            // Arrange
            var administrator = new Persons(this.Session).FindBy(Persons.Meta.UserName, Users.AdministratorUserName);

            var c1a = new C1Builder(this.Session)
               .WithC1AllorsString("c1")
               .WithI1AllorsString("i1")
               .WithI12AllorsString("i12")
               .Build();

            this.Session.Derive();
            this.Session.Commit();

            var loadRequest = new LoadRequest
            {
                Objects = new[] { c1a.Id.ToString() }
            };

            var controller = new AngularController { AllorsSession = this.Session, AuthenticatedUser = administrator};

            // Act
            var jsonResult = (JsonResult)controller.Load(loadRequest);
            var loadResponse = (LoadResponse)jsonResult.Data;

            // Assert
            loadResponse.Objects.Length.ShouldEqual(1);

            var responseC1a = loadResponse.Objects[0];

            responseC1a.Roles.Length.ShouldEqual(2);

            var responseC1AllorsString = responseC1a.Roles.First(v => v[0].Equals("C1AllorsString"));
            responseC1AllorsString[1].ShouldEqual("rw");
            responseC1AllorsString[2].ShouldEqual("c1");

            var responseI1AllorsString = responseC1a.Roles.First(v => v[0].Equals("I1AllorsString"));
            responseI1AllorsString[1].ShouldEqual("rw");
            responseI1AllorsString[2].ShouldEqual("i1");
        }
예제 #31
0
파일: LoadTests.cs 프로젝트: whesius/allors
        public void Guest()
        {
            // Arrange
            var c1a = new C1Builder(this.Session)
               .WithC1AllorsString("c1")
               .WithI1AllorsString("i1")
               .WithI12AllorsString("i12")
               .Build();

            this.Session.Derive();
            this.Session.Commit();

            var loadRequest = new LoadRequest
            {
                Objects = new []{ c1a.Id.ToString() }
            };

            var controller = new AngularController { AllorsSession = this.Session };

            // Act
            var jsonResult = (JsonResult)controller.Load(loadRequest);
            var loadResponse = (LoadResponse)jsonResult.Data;

            // Assert
            loadResponse.Objects.Length.ShouldEqual(1);

            var responseC1a = loadResponse.Objects[0];

            responseC1a.Roles.Length.ShouldEqual(2);

            var responseC1AllorsString = responseC1a.Roles.First(v => v[0].Equals("C1AllorsString"));
            responseC1AllorsString[1].ShouldEqual("r");
            responseC1AllorsString[2].ShouldEqual("c1");

            var responseI1AllorsString = responseC1a.Roles.First(v => v[0].Equals("I1AllorsString"));
            responseI1AllorsString[1].ShouldEqual("r");
            responseI1AllorsString[2].ShouldEqual("i1");
        }
예제 #32
0
        public void SortDiamond()
        {
            var a = new C1Builder(this.DatabaseSession).Build();
            var b = new C1Builder(this.DatabaseSession).Build();
            var c = new C1Builder(this.DatabaseSession).Build();
            var d = new C1Builder(this.DatabaseSession).Build();

            a.AddDependency(b);
            a.AddDependency(c);

            b.AddDependency(d);
            c.AddDependency(d);

            var derivation = new Derivation(this.DatabaseSession);

            var sequence = new List<IObject>();
            derivation["sequence"] = sequence;

            derivation.Derive();

            Assert.AreEqual(d, sequence[0]);
            Assert.AreEqual(a, sequence[3]);
        }
예제 #33
0
        public void One2ManyWithPropertyTypeIds()
        {
            var c2A = new C2Builder(this.Session).WithC2AllorsString("c2A").Build();
            var c2B = new C2Builder(this.Session).WithC2AllorsString("c2B").Build();
            var c2C = new C2Builder(this.Session).WithC2AllorsString("c2C").Build();

            var c1a = new C1Builder(this.Session)
                      .WithC1AllorsString("c1A")
                      .WithC1C2One2Many(c2A)
                      .Build();

            var c1b = new C1Builder(this.Session)
                      .WithC1AllorsString("c1B")
                      .WithC1C2One2Many(c2B)
                      .WithC1C2One2Many(c2C)
                      .Build();

            this.Session.Derive(true);

            var path = new Path(MetaC1.Instance.C1C2One2Manies, MetaC2.Instance.C2AllorsString);

            var aclMock = new Mock <IAccessControlList>();

            aclMock.Setup(acl => acl.CanRead(It.IsAny <PropertyType>())).Returns(true);
            var acls = new AccessControlListCache(null, (allorsObject, user) => aclMock.Object);

            var result = (ISet <object>)path.Get(c1a, acls);

            Assert.AreEqual(1, result.Count);
            Assert.IsTrue(result.Contains("c2A"));

            result = (ISet <object>)path.Get(c1b, acls);
            Assert.AreEqual(2, result.Count);
            Assert.IsTrue(result.Contains("c2B"));
            Assert.IsTrue(result.Contains("c2C"));
        }
        public void SortDiamond()
        {
            var a = new C1Builder(this.Session).Build();
            var b = new C1Builder(this.Session).Build();
            var c = new C1Builder(this.Session).Build();
            var d = new C1Builder(this.Session).Build();

            a.AddDependency(b);
            a.AddDependency(c);

            b.AddDependency(d);
            c.AddDependency(d);

            var derivation = new Derivation(this.Session);

            var sequence = new List <IObject>();

            derivation["sequence"] = sequence;

            derivation.Derive();

            Assert.AreEqual(d, sequence[0]);
            Assert.AreEqual(a, sequence[3]);
        }
예제 #35
0
        private void Full()
        {
            var c1A = new C1Builder(session).WithName("c1A").Build();
            var c1B = new C1Builder(session).WithName("c1B").Build();
            var c1C = new C1Builder(session).WithName("c1C").Build();
            var c1D = new C1Builder(session).WithName("c1D").Build();
            var c2A = new C2Builder(session).WithName("c2A").Build();
            var c2B = new C2Builder(session).WithName("c2B").Build();
            var c2C = new C2Builder(session).WithName("c2C").Build();
            var c2D = new C2Builder(session).WithName("c2D").Build();

            #region String
            // class
            c1B.C1AllorsString = "ᴀbra";
            c1C.C1AllorsString = "ᴀbracadabra";
            c1D.C1AllorsString = "ᴀbracadabra";

            c2B.C2AllorsString = "ᴀbra";
            c2C.C2AllorsString = "ᴀbracadabra";
            c2D.C2AllorsString = "ᴀbracadabra";
            // exclusive interface
            c1B.I1AllorsString = "ᴀbra";
            c1C.I1AllorsString = "ᴀbracadabra";
            c1D.I1AllorsString = "ᴀbracadabra";

            // shared interface
            c1B.I12AllorsString = "ᴀbra";
            c1C.I12AllorsString = "ᴀbracadabra";
            c1D.I12AllorsString = "ᴀbracadabra";
            c2B.I12AllorsString = "ᴀbra";
            c2C.I12AllorsString = "ᴀbracadabra";
            c2D.I12AllorsString = "ᴀbracadabra";
            #endregion

            #region Integer
            c1B.C1AllorsInteger = 1;
            c1C.C1AllorsInteger = 2;
            c1D.C1AllorsInteger = 2;

            c1B.I1AllorsInteger = 1;
            c1C.I1AllorsInteger = 2;
            c1D.I1AllorsInteger = 2;

            c1B.I12AllorsInteger = 1;
            c1C.I12AllorsInteger = 2;
            c1D.I12AllorsInteger = 2;
            c2B.I12AllorsInteger = 1;
            c2C.I12AllorsInteger = 2;
            c2D.I12AllorsInteger = 2;
            #endregion

            #region DateTime
            // DateTime
            c1B.C1AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 4, DateTimeKind.Utc);
            c1C.C1AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc);
            c1D.C1AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc);

            c1B.I1AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 4, DateTimeKind.Utc);
            c1C.I1AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc);
            c1D.I1AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc);

            c1B.I12AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 4, DateTimeKind.Utc);
            c1C.I12AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc);
            c1D.I12AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc);
            c2B.I12AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 4, DateTimeKind.Utc);
            c2C.I12AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc);
            c2D.I12AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc);
            #endregion

            #region Float
            c1B.C1AllorsDouble = 1;
            c1C.C1AllorsDouble = 2;
            c1D.C1AllorsDouble = 2;

            c1B.I1AllorsDouble = 1;
            c1C.I1AllorsDouble = 2;
            c1D.I1AllorsDouble = 2;

            c1B.I12AllorsDouble = 1;
            c1C.I12AllorsDouble = 2;
            c1D.I12AllorsDouble = 2;
            c2B.I12AllorsDouble = 1;
            c2C.I12AllorsDouble = 2;
            c2D.I12AllorsDouble = 2;
            #endregion

            #region Decimal
            c1B.C1AllorsDecimal = 1;
            c1C.C1AllorsDecimal = 2;
            c1D.C1AllorsDecimal = 2;

            c1B.I1AllorsDecimal = 1;
            c1C.I1AllorsDecimal = 2;
            c1D.I1AllorsDecimal = 2;

            c1B.I12AllorsDecimal = 1;
            c1C.I12AllorsDecimal = 2;
            c1D.I12AllorsDecimal = 2;
            c2B.I12AllorsDecimal = 1;
            c2C.I12AllorsDecimal = 2;
            c2D.I12AllorsDecimal = 2;
            #endregion

            #region One to One
            c1B.C1C1One2One = c1B;
            c1C.C1C1One2One = c1C;
            c1D.C1C1One2One = c1D;

            c1B.C1C2One2One = c2B;
            c1C.C1C2One2One = c2C;
            c1D.C1C2One2One = c2D;

            c1B.I1I2One2One = c2B;
            c1C.I1I2One2One = c2C;
            c1D.I1I2One2One = c2D;

            c1B.I12C2One2One = c2B;
            c1C.I12C2One2One = c2C;
            c1D.I12C2One2One = c2D;
            c2A.I12C2One2One = c2A;

            c1B.C1I12One2One = c1B;
            c1C.C1I12One2One = c2B;
            c1D.C1I12One2One = c2C;
            #endregion

            #region One to Many
            c1B.AddC1C1One2Many(c1B);
            c1C.AddC1C1One2Many(c1C);
            c1C.AddC1C1One2Many(c1D);

            c1B.AddC1C2One2Many(c2B);
            c1C.AddC1C2One2Many(c2C);
            c1C.AddC1C2One2Many(c2D);

            c1B.AddI1I2One2Many(c2B);
            c1C.AddI1I2One2Many(c2C);
            c1C.AddI1I2One2Many(c2D);

            c1B.AddC1I12One2Many(c1B);
            c1C.AddC1I12One2Many(c2C);
            c1C.AddC1I12One2Many(c2D);
            #endregion

            #region Many to One
            c1B.C1C1Many2One = c1B;
            c1C.C1C1Many2One = c1C;
            c1D.C1C1Many2One = c1C;

            c1B.C1C2Many2One = c2B;
            c1C.C1C2Many2One = c2C;
            c1D.C1C2Many2One = c2C;

            c1B.I1I2Many2One = c2B;
            c1C.I1I2Many2One = c2C;
            c1D.I1I2Many2One = c2C;

            c1B.I12C2Many2One = c2B;
            c2C.I12C2Many2One = c2C;
            c2D.I12C2Many2One = c2C;

            c1B.C1I12Many2One = c1B;
            c1C.C1I12Many2One = c2C;
            c1D.C1I12Many2One = c2C;
            #endregion

            #region Many to Many
            c1B.AddC1C1Many2Many(c1B);
            c1C.AddC1C1Many2Many(c1B);
            c1D.AddC1C1Many2Many(c1B);
            c1C.AddC1C1Many2Many(c1C);
            c1D.AddC1C1Many2Many(c1C);
            c1D.AddC1C1Many2Many(c1D);

            c1B.AddC1C2Many2Many(c2B);
            c1C.AddC1C2Many2Many(c2B);
            c1D.AddC1C2Many2Many(c2B);
            c1C.AddC1C2Many2Many(c2C);
            c1D.AddC1C2Many2Many(c2C);
            c1D.AddC1C2Many2Many(c2D);

            c1B.AddI1I2Many2Many(c2B);
            c1C.AddI1I2Many2Many(c2B);
            c1C.AddI1I2Many2Many(c2C);
            c1D.AddI1I2Many2Many(c2B);
            c1D.AddI1I2Many2Many(c2C);
            c1D.AddI1I2Many2Many(c2D);

            c1B.AddI12C2Many2Many(c2B);
            c1C.AddI12C2Many2Many(c2B);
            c1C.AddI12C2Many2Many(c2C);
            c1D.AddI12C2Many2Many(c2B);
            c1D.AddI12C2Many2Many(c2C);
            c1D.AddI12C2Many2Many(c2D);
            c2A.AddI12C2Many2Many(c2A);
            c2A.AddI12C2Many2Many(c2B);
            c2A.AddI12C2Many2Many(c2C);
            c2A.AddI12C2Many2Many(c2D);

            c1B.AddC1I12Many2Many(c1B);
            c1B.AddC1I12Many2Many(c2B);
            c1C.AddC1I12Many2Many(c2B);
            c1C.AddC1I12Many2Many(c2C);
            c1D.AddC1I12Many2Many(c2B);
            c1D.AddC1I12Many2Many(c2C);
            c1D.AddC1I12Many2Many(c2D);
            #endregion
        }
예제 #36
0
파일: SaveTests.cs 프로젝트: whesius/allors
        public void GuestSetUnit()
        {
            // Arrange
            var c1a = new C1Builder(this.Session)
               .WithC1AllorsString("c1")
               .WithI1AllorsString("i1")
               .WithI12AllorsString("i12")
               .Build();

            this.Session.Derive();
            this.Session.Commit();

            var saveRequest = new SaveRequest
            {
                Objects = new[] {
                    new SaveRequestObject
                    {
                        I = c1a.Id.ToString(),
                        V = c1a.Strategy.ObjectVersion.ToString(),
                        Roles = new List<SaveRequestRole>
                        {
                            new SaveRequestRole
                            {
                                T = "C1AllorsString",
                                S = "new c1"
                            }
                        }
                    }
                }
            };

            var controller = new AngularController { AllorsSession = this.Session };

            // Act
            var jsonResult = (JsonResult)controller.Save(saveRequest);
            var saveResponse = (SaveResponse)jsonResult.Data;

            // Assert
            this.Session.Rollback();

            saveResponse.Errors.Count.ShouldEqual(1);

            c1a.C1AllorsString.ShouldEqual("c1");
        }
예제 #37
0
        public void SuperinterfaceMethod()
        {
            var c1 = new C1Builder(this.DatabaseSession)
                .Build();

            var interfaceMethod = c1.SuperinterfaceMethod();

            Assert.AreEqual("S1TestS1BaseS1CoreI1TestI1BaseI1CoreC1TestC1BaseC1Core", interfaceMethod.Value);
        }
예제 #38
0
        public void Administrator()
        {
            // Arrange
            var administrator = new People(this.Session).FindBy(M.Person.UserName, Users.AdministratorUserName);

            this.Session.Derive(true);

            var c1a = new C1Builder(this.Session)
                      .WithC1AllorsString("c1")
                      .WithI1AllorsString("i1")
                      .WithI12AllorsString("i12")
                      .Build();

            this.Session.Derive();
            this.Session.Commit();

            var syncRequest = new SyncRequest
            {
                Objects = new[] { c1a.Id.ToString() }
            };

            var controller = new DatabaseController {
                AllorsSession = this.Session, AllorsUser = administrator
            };

            // Act
            var jsonResult   = (JsonResult)controller.Sync(syncRequest);
            var syncResponse = (SyncResponse)jsonResult.Data;

            // Assert
            syncResponse.Objects.Length.ShouldEqual(1);

            var responseC1a = syncResponse.Objects[0];

            var roles = responseC1a.Roles;

            roles.Length.ShouldEqual(5);

            // Roles
            var responseC1AllorsString = roles.First(v => v[0].Equals("C1AllorsString"));

            responseC1AllorsString.Length.ShouldEqual(3);
            responseC1AllorsString[1].ShouldEqual("rw");
            responseC1AllorsString[2].ShouldEqual("c1");

            var responseI1AllorsString = roles.First(v => v[0].Equals("I1AllorsString"));

            responseI1AllorsString.Length.ShouldEqual(3);
            responseI1AllorsString[1].ShouldEqual("rw");
            responseI1AllorsString[2].ShouldEqual("i1");

            // Null's
            var responseC1AllorsBoolean = roles.First(v => v[0].Equals("C1AllorsBinary"));

            responseC1AllorsBoolean.Length.ShouldEqual(2);
            responseC1AllorsBoolean[1].ShouldEqual("rw");

            var responseC1One2One = roles.First(v => v[0].Equals("C1C1One2One"));

            responseC1One2One.Length.ShouldEqual(2);
            responseC1One2One[1].ShouldEqual("rw");

            var responseC1One2Many = roles.First(v => v[0].Equals("C1C1One2Manies"));

            responseC1One2Many.Length.ShouldEqual(2);
            responseC1One2Many[1].ShouldEqual("rw");

            // Methods
            var methods = responseC1a.Methods;

            methods.Length.ShouldEqual(1);

            var responseClassMethod = methods.First(v => v[0].Equals("ClassMethod"));

            responseClassMethod.Length.ShouldEqual(2);
            responseClassMethod[1].ShouldEqual("x");
        }
예제 #39
0
        private void Full()
        {
            new PersonBuilder(this.session).WithUserName("noacl").WithFirstName("no").WithLastName("acl").Build();

            var noperm               = new PersonBuilder(this.session).WithUserName("noperm").WithFirstName("no").WithLastName("perm").Build();
            var emptyRole            = new RoleBuilder(this.session).WithName("Empty").Build();
            var defaultSecurityToken = new SecurityTokens(this.session).DefaultSecurityToken;

            var acl = new AccessControlBuilder(this.session).WithRole(emptyRole).WithSubject(noperm).WithSecurityToken(defaultSecurityToken).Build();

            var c1A = new C1Builder(this.session).WithName("c1A").Build();
            var c1B = new C1Builder(this.session).WithName("c1B").Build();
            var c1C = new C1Builder(this.session).WithName("c1C").Build();
            var c1D = new C1Builder(this.session).WithName("c1D").Build();
            var c2A = new C2Builder(this.session).WithName("c2A").Build();
            var c2B = new C2Builder(this.session).WithName("c2B").Build();
            var c2C = new C2Builder(this.session).WithName("c2C").Build();
            var c2D = new C2Builder(this.session).WithName("c2D").Build();

            // class
            c1B.C1AllorsString = "ᴀbra";
            c1C.C1AllorsString = "ᴀbracadabra";
            c1D.C1AllorsString = "ᴀbracadabra";

            c2B.C2AllorsString = "ᴀbra";
            c2C.C2AllorsString = "ᴀbracadabra";
            c2D.C2AllorsString = "ᴀbracadabra";
            // exclusive interface
            c1B.I1AllorsString = "ᴀbra";
            c1C.I1AllorsString = "ᴀbracadabra";
            c1D.I1AllorsString = "ᴀbracadabra";

            // shared interface
            c1B.I12AllorsString = "ᴀbra";
            c1C.I12AllorsString = "ᴀbracadabra";
            c1D.I12AllorsString = "ᴀbracadabra";
            c2B.I12AllorsString = "ᴀbra";
            c2C.I12AllorsString = "ᴀbracadabra";
            c2D.I12AllorsString = "ᴀbracadabra";

            c1B.C1AllorsInteger = 1;
            c1C.C1AllorsInteger = 2;
            c1D.C1AllorsInteger = 2;

            c1B.I1AllorsInteger = 1;
            c1C.I1AllorsInteger = 2;
            c1D.I1AllorsInteger = 2;

            c1B.I12AllorsInteger = 1;
            c1C.I12AllorsInteger = 2;
            c1D.I12AllorsInteger = 2;
            c2B.I12AllorsInteger = 1;
            c2C.I12AllorsInteger = 2;
            c2D.I12AllorsInteger = 2;

            // DateTime
            c1B.C1AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 4, DateTimeKind.Utc);
            c1C.C1AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc);
            c1D.C1AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc);

            c1B.I1AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 4, DateTimeKind.Utc);
            c1C.I1AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc);
            c1D.I1AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc);

            c1B.I12AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 4, DateTimeKind.Utc);
            c1C.I12AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc);
            c1D.I12AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc);
            c2B.I12AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 4, DateTimeKind.Utc);
            c2C.I12AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc);
            c2D.I12AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc);

            c1B.C1AllorsDouble = 1;
            c1C.C1AllorsDouble = 2;
            c1D.C1AllorsDouble = 2;

            c1B.I1AllorsDouble = 1;
            c1C.I1AllorsDouble = 2;
            c1D.I1AllorsDouble = 2;

            c1B.I12AllorsDouble = 1;
            c1C.I12AllorsDouble = 2;
            c1D.I12AllorsDouble = 2;
            c2B.I12AllorsDouble = 1;
            c2C.I12AllorsDouble = 2;
            c2D.I12AllorsDouble = 2;

            c1B.C1AllorsDecimal = 1;
            c1C.C1AllorsDecimal = 2;
            c1D.C1AllorsDecimal = 2;

            c1B.I1AllorsDecimal = 1;
            c1C.I1AllorsDecimal = 2;
            c1D.I1AllorsDecimal = 2;

            c1B.I12AllorsDecimal = 1;
            c1C.I12AllorsDecimal = 2;
            c1D.I12AllorsDecimal = 2;
            c2B.I12AllorsDecimal = 1;
            c2C.I12AllorsDecimal = 2;
            c2D.I12AllorsDecimal = 2;

            c1B.C1C1One2One = c1B;
            c1C.C1C1One2One = c1C;
            c1D.C1C1One2One = c1D;

            c1B.C1C2One2One = c2B;
            c1C.C1C2One2One = c2C;
            c1D.C1C2One2One = c2D;

            c1B.I1I2One2One = c2B;
            c1C.I1I2One2One = c2C;
            c1D.I1I2One2One = c2D;

            c1B.I12C2One2One = c2B;
            c1C.I12C2One2One = c2C;
            c1D.I12C2One2One = c2D;
            c2A.I12C2One2One = c2A;

            c1B.C1I12One2One = c1B;
            c1C.C1I12One2One = c2B;
            c1D.C1I12One2One = c2C;

            c1B.AddC1C1One2Many(c1B);
            c1C.AddC1C1One2Many(c1C);
            c1C.AddC1C1One2Many(c1D);

            c1B.AddC1C2One2Many(c2B);
            c1C.AddC1C2One2Many(c2C);
            c1C.AddC1C2One2Many(c2D);

            c1B.AddI1I2One2Many(c2B);
            c1C.AddI1I2One2Many(c2C);
            c1C.AddI1I2One2Many(c2D);

            c1B.AddC1I12One2Many(c1B);
            c1C.AddC1I12One2Many(c2C);
            c1C.AddC1I12One2Many(c2D);

            c1B.C1C1Many2One = c1B;
            c1C.C1C1Many2One = c1C;
            c1D.C1C1Many2One = c1C;

            c1B.C1C2Many2One = c2B;
            c1C.C1C2Many2One = c2C;
            c1D.C1C2Many2One = c2C;

            c1B.I1I2Many2One = c2B;
            c1C.I1I2Many2One = c2C;
            c1D.I1I2Many2One = c2C;

            c1B.I12C2Many2One = c2B;
            c2C.I12C2Many2One = c2C;
            c2D.I12C2Many2One = c2C;

            c1B.C1I12Many2One = c1B;
            c1C.C1I12Many2One = c2C;
            c1D.C1I12Many2One = c2C;

            c1B.AddC1C1Many2Many(c1B);
            c1C.AddC1C1Many2Many(c1B);
            c1D.AddC1C1Many2Many(c1B);
            c1C.AddC1C1Many2Many(c1C);
            c1D.AddC1C1Many2Many(c1C);
            c1D.AddC1C1Many2Many(c1D);

            c1B.AddC1C2Many2Many(c2B);
            c1C.AddC1C2Many2Many(c2B);
            c1D.AddC1C2Many2Many(c2B);
            c1C.AddC1C2Many2Many(c2C);
            c1D.AddC1C2Many2Many(c2C);
            c1D.AddC1C2Many2Many(c2D);

            c1B.AddI1I2Many2Many(c2B);
            c1C.AddI1I2Many2Many(c2B);
            c1C.AddI1I2Many2Many(c2C);
            c1D.AddI1I2Many2Many(c2B);
            c1D.AddI1I2Many2Many(c2C);
            c1D.AddI1I2Many2Many(c2D);

            c1B.AddI12C2Many2Many(c2B);
            c1C.AddI12C2Many2Many(c2B);
            c1C.AddI12C2Many2Many(c2C);
            c1D.AddI12C2Many2Many(c2B);
            c1D.AddI12C2Many2Many(c2C);
            c1D.AddI12C2Many2Many(c2D);
            c2A.AddI12C2Many2Many(c2A);
            c2A.AddI12C2Many2Many(c2B);
            c2A.AddI12C2Many2Many(c2C);
            c2A.AddI12C2Many2Many(c2D);

            c1B.AddC1I12Many2Many(c1B);
            c1B.AddC1I12Many2Many(c2B);
            c1C.AddC1I12Many2Many(c2B);
            c1C.AddC1I12Many2Many(c2C);
            c1D.AddC1I12Many2Many(c2B);
            c1D.AddC1I12Many2Many(c2C);
            c1D.AddC1I12Many2Many(c2D);
        }