public void TestMessageChildType()
        {
            var sut       = typeof(MessageChild);
            var ancestors = MessageHierarchy.AncestorsAndSelf(sut);

            Assert.Equal(3, ancestors.Count());
            Assert.Contains(typeof(Message), ancestors);
            Assert.Contains(typeof(MessageParent), ancestors);
            Assert.Contains(typeof(MessageChild), ancestors);

            var descendants = MessageHierarchy.DescendantsAndSelf(sut);

            Assert.Single(descendants);
            Assert.Contains(typeof(MessageChild), descendants);
        }
Example #2
0
    public static void Main()
    {
        var type = typeof(Message);

        Console.WriteLine("MessageChild has " + MessageHierarchy.AncestorsAndSelf(type).Count() + " Ancestors");
        foreach (var parent in MessageHierarchy.AncestorsAndSelf(type))
        {
            Console.WriteLine(parent);
        }

        Console.WriteLine($"{type} has {MessageHierarchy.DescendantsAndSelf(type).Count()} Descendants");
        foreach (var descendant in MessageHierarchy.DescendantsAndSelf(type))
        {
            Console.WriteLine(descendant);
        }
    }
        public void TestMessageAncestors()
        {
            var sut       = typeof(Message);
            var ancestors = MessageHierarchy.AncestorsAndSelf(sut).ToList();

            Assert.Single(ancestors);
            Assert.Contains(typeof(Message), ancestors);

            sut       = typeof(ParentTestEvent);
            ancestors = MessageHierarchy.AncestorsAndSelf(sut).ToList();
            Assert.Equal(4, ancestors.Count());
            Assert.Contains(typeof(ParentTestEvent), ancestors);
            Assert.Contains(typeof(CorrelatedMessage), ancestors);
            Assert.Contains(typeof(Event), ancestors);
            Assert.Contains(typeof(Message), ancestors);
        }
Example #4
0
        public void TestMessageAncestors()
        {
            var sut       = typeof(Message);
            var ancestors = MessageHierarchy.AncestorsAndSelf(sut).ToList();

            Assert.Collection(ancestors,
                              x => Assert.Equal(typeof(Message), x),
                              x => Assert.Equal(typeof(object), x)
                              );

            sut       = typeof(ParentTestEvent);
            ancestors = MessageHierarchy.AncestorsAndSelf(sut).ToList();
            Assert.Equal(3, ancestors.Count());
            Assert.Contains(typeof(ParentTestEvent), ancestors);
            Assert.Contains(typeof(Message), ancestors);
            Assert.Contains(typeof(object), ancestors);
        }