Ejemplo n.º 1
0
            public void IdIsTheSameAfterClone()
            {
                // Given
                CustomObject obj      = new CustomObject();
                IDocument    document = new ObjectDocument <CustomObject>(obj);

                // When
                IDocument cloned = document.Clone(null);

                // Then
                Assert.AreEqual(document.Id, cloned.Id);
            }
Ejemplo n.º 2
0
            public void DocumentTypeTheSameAfterClone()
            {
                // Given
                CustomObject obj      = new CustomObject();
                IDocument    document = new ObjectDocument <CustomObject>(obj);

                // When
                IDocument cloned = document.Clone(null);

                // Then
                cloned.ShouldBeOfType <ObjectDocument <CustomObject> >();
            }
Ejemplo n.º 3
0
            public void MembersAreCloned()
            {
                // Given
                CustomObject obj = new CustomObject
                {
                    Foo = "abc"
                };
                IDocument document = new ObjectDocument <CustomObject>(obj);

                // When
                IDocument cloned = document.Clone(null);

                // Then
                ((ObjectDocument <CustomObject>)cloned).Object.Foo.ShouldBe("abc");
            }
Ejemplo n.º 4
0
            public void GetsPropertyMetadata()
            {
                // Given
                CustomObject obj = new CustomObject
                {
                    Foo = "abc"
                };
                IDocument document = new ObjectDocument <CustomObject>(obj);
                IDocument cloned   = document.Clone(new MetadataItems {
                    { "Foo", "xyz" }
                });

                // When
                string initialValue = document.GetString("Foo");
                string clonedValue  = cloned.GetString("Foo");

                // Then
                initialValue.ShouldBe("abc");
                clonedValue.ShouldBe("xyz");
            }
Ejemplo n.º 5
0
            public void MetadataOverwritesSettings()
            {
                // Given
                CustomObject obj = new CustomObject
                {
                    Foo = "abc"
                };
                MetadataItems settings = new MetadataItems
                {
                    { "A", "a" }
                };
                IDocument document = new ObjectDocument <CustomObject>(obj, new Metadata(settings));
                IDocument cloned   = document.Clone(new MetadataItems {
                    { "A", "b" }
                });

                // When
                string initialValue = document.GetString("A");
                string clonedValue  = cloned.GetString("A");

                // Then
                initialValue.ShouldBe("a");
                clonedValue.ShouldBe("b");
            }