AK.F1.Timing.Serialization.DecoratedObjectWriterTest.graphs_which_contain_circular_references_are_not_supported C# (CSharp) Method

graphs_which_contain_circular_references_are_not_supported() private method

        public void graphs_which_contain_circular_references_are_not_supported()
        {
            var graph = new SimpleType();
            // Root to self.
            graph.Value = graph;
            Assert.Throws<SerializationException>(() => Write(graph));
            // Descendent to root.
            graph.Value = new SimpleType { Value = graph };
            Assert.Throws<SerializationException>(() => Write(graph));
            // Descendent to self.
            graph.Value = new SimpleType();
            graph.Value.Value = graph.Value;
            Assert.Throws<SerializationException>(() => Write(graph));
            // Descendent to parent.
            graph.Value = new SimpleType { Value = graph.Value };
            Assert.Throws<SerializationException>(() => Write(graph));
        }