Exemplo n.º 1
0
        public void ChildEquality()
        {
            Csla.ApplicationContext.GlobalContext.Clear();
            Root root = Root.NewRoot();

            root.Children.Add("abc");
            root.Children.Add("xyz");
            root.Children.Add("123");
            Child c1 = root.Children[0];
            Child c2 = root.Children[1];
            Child c3 = root.Children[2];

            root.Children.Remove(c3);

            Assert.AreEqual(true, c1.Equals(c1), "objects should be equal");
            Assert.AreEqual(true, Equals(c1, c1), "objects should be equal");

            Assert.AreEqual(false, c1.Equals(c2), "objects should not be equal");
            Assert.AreEqual(false, Equals(c1, c2), "objects should not be equal");

            Assert.AreEqual(false, c1.Equals(null), "objects should not be equal");
            Assert.AreEqual(false, Equals(c1, null), "objects should not be equal");
            Assert.AreEqual(false, Equals(null, c2), "objects should not be equal");

            Assert.AreEqual(true, root.Children.Contains(c1), "Collection should contain c1");
            Assert.AreEqual(true, root.Children.Contains(c2), "collection should contain c2");
            Assert.AreEqual(false, root.Children.Contains(c3), "collection should not contain c3");
            Assert.AreEqual(true, root.Children.ContainsDeleted(c3), "Deleted collection should contain c3");
        }
Exemplo n.º 2
0
        public void ChildEquality()
        {
#pragma warning disable CS0618 // Type or member is obsolete
            Csla.ApplicationContext.GlobalContext.Clear();
#pragma warning restore CS0618 // Type or member is obsolete
            Root root = Root.NewRoot();
            root.Children.Add("abc");
            root.Children.Add("xyz");
            root.Children.Add("123");
            Child c1 = root.Children[0];
            Child c2 = root.Children[1];
            Child c3 = root.Children[2];
            root.Children.Remove(c3);

            Assert.AreEqual(true, c1.Equals(c1), "objects should be equal");
            Assert.AreEqual(true, Equals(c1, c1), "objects should be equal");

            Assert.AreEqual(false, c1.Equals(c2), "objects should not be equal");
            Assert.AreEqual(false, Equals(c1, c2), "objects should not be equal");

            Assert.AreEqual(false, c1.Equals(null), "objects should not be equal");
            Assert.AreEqual(false, Equals(c1, null), "objects should not be equal");
            Assert.AreEqual(false, Equals(null, c2), "objects should not be equal");

            Assert.AreEqual(true, root.Children.Contains(c1), "Collection should contain c1");
            Assert.AreEqual(true, root.Children.Contains(c2), "collection should contain c2");
            Assert.AreEqual(false, root.Children.Contains(c3), "collection should not contain c3");
            Assert.AreEqual(true, root.Children.ContainsDeleted(c3), "Deleted collection should contain c3");
        }
Exemplo n.º 3
0
        public void BasicEquality()
        {
            Csla.ApplicationContext.GlobalContext.Clear();
            Root r1 = Root.NewRoot();

            r1.Data = "abc";
            Assert.AreEqual(true, r1.Equals(r1), "objects should be equal on instance compare");
            Assert.AreEqual(true, Equals(r1, r1), "objects should be equal on static compare");

            Csla.ApplicationContext.GlobalContext.Clear();
            Root r2 = Root.NewRoot();

            r2.Data = "xyz";
            Assert.AreEqual(false, r1.Equals(r2), "objects should not be equal");
            Assert.AreEqual(false, Equals(r1, r2), "objects should not be equal");

            Assert.AreEqual(false, r1.Equals(null), "Objects should not be equal");
            Assert.AreEqual(false, Equals(r1, null), "Objects should not be equal");
            Assert.AreEqual(false, Equals(null, r2), "Objects should not be equal");
        }
Exemplo n.º 4
0
        public void BasicEquality()
        {
#pragma warning disable CS0618 // Type or member is obsolete
            Csla.ApplicationContext.GlobalContext.Clear();
#pragma warning restore CS0618 // Type or member is obsolete
            Root r1 = Root.NewRoot();
            r1.Data = "abc";
            Assert.AreEqual(true, r1.Equals(r1), "objects should be equal on instance compare");
            Assert.AreEqual(true, Equals(r1, r1), "objects should be equal on static compare");

#pragma warning disable CS0618 // Type or member is obsolete
            Csla.ApplicationContext.GlobalContext.Clear();
#pragma warning restore CS0618 // Type or member is obsolete
            Root r2 = Root.NewRoot();
            r2.Data = "xyz";
            Assert.AreEqual(false, r1.Equals(r2), "objects should not be equal");
            Assert.AreEqual(false, Equals(r1, r2), "objects should not be equal");

            Assert.AreEqual(false, r1.Equals(null), "Objects should not be equal");
            Assert.AreEqual(false, Equals(r1, null), "Objects should not be equal");
            Assert.AreEqual(false, Equals(null, r2), "Objects should not be equal");
        }