public void GetHashCode_should_return_true_for_child_with_complex_parent_in_other_assembly()
        {
            var first = new ComplexChild();

            first.InChildNumber      = 1;
            first.InChildText        = "test";
            first.InChildCollection  = new[] { 1, 2 };
            first.InParentNumber     = 1;
            first.InParentText       = "test";
            first.InParentCollection = new[] { 1, 2 };

            var result = first.GetHashCode();

            Assert.NotEqual(0, result);
        }
Exemplo n.º 2
0
        public void CopyFrom_Copies_Source_Properties()
        {
            ComplexChild  sourceChild = new ComplexChild();
            ComplexParent parent      = new ComplexParent();

            sourceChild.Parent       = parent;
            sourceChild.GroupId      = 317;
            sourceChild.ParentId     = 179;
            sourceChild.CreationTime = DateTime.Now;
            sourceChild.Note         = "Some pretty nice note.";

            ComplexChild target = new ComplexChild();

            target.CopyFrom(sourceChild);

            Assert.AreEqual(sourceChild.Parent, target.Parent);
            Assert.AreEqual(sourceChild.GroupId, target.GroupId);
            Assert.AreEqual(sourceChild.ParentId, target.ParentId);
            Assert.AreEqual(sourceChild.CreationTime, target.CreationTime);
            Assert.AreEqual(sourceChild.Note, target.Note);
        }
        public void Equality_operator_should_return_true_for_child_with_complex_parent_in_other_assembly()
        {
            var first = new ComplexChild();

            first.InChildNumber      = 1;
            first.InChildText        = "test";
            first.InChildCollection  = new[] { 1, 2 };
            first.InParentNumber     = 1;
            first.InParentText       = "test";
            first.InParentCollection = new[] { 1, 2 };

            var second = new ComplexChild();

            second.InChildNumber      = 1;
            second.InChildText        = "test";
            second.InChildCollection  = new[] { 1, 2 };
            second.InParentNumber     = 1;
            second.InParentText       = "test";
            second.InParentCollection = new[] { 1, 2 };

            Assert.True(first == second);
            Assert.False(first != second);
        }
Exemplo n.º 4
0
        public void CopyFrom_Doesnot_Copy_Source_Id()
        {
            int targetId      = 797;
            int sourceChildId = 111;

            ComplexChild  sourceChild = new ComplexChild();
            ComplexParent parent      = new ComplexParent();

            sourceChild.Id           = sourceChildId;
            sourceChild.Parent       = parent;
            sourceChild.GroupId      = 317;
            sourceChild.ParentId     = 179;
            sourceChild.CreationTime = DateTime.Now;
            sourceChild.Note         = "Some pretty nice note.";

            ComplexChild target = new ComplexChild();

            target.Id = targetId;
            target.CopyFrom(sourceChild);

            Assert.AreNotEqual(sourceChild.Id, target.Id);
            Assert.AreEqual(targetId, target.Id);
        }
Exemplo n.º 5
0
 public ComplexParent(ComplexChild child)
 {
     this.Child = child;
 }
Exemplo n.º 6
0
 public ComplexParent(ComplexChild child)
 {
     this.Child = child;
 }