public void GeneratesType_open_generic()
        {
            var generator = new DirectiveGenerator();
            var typeInfo  = typeof(A.B <>).GetTypeInfo();

            Assert.Contains("<Type Name=\"A.B{TChild}\" Dynamic=\"Required All\" />", generator.GenerateXml(new[] { typeInfo }));
        }
        public void GeneratesTypeInstantiation_closed_generic()
        {
            var generator = new DirectiveGenerator();
            var typeInfo  = typeof(A.B <A.C>).GetTypeInfo();

            Assert.Contains("<TypeInstantiation Name=\"A.B\" Arguments=\"A.C\" Dynamic=\"Required All\" />", generator.GenerateXml(new[] { typeInfo }));
        }
        public void GeneratesMethodInstantiation()
        {
            var generator  = new DirectiveGenerator();
            var methodInfo = typeof(A.C).GetTypeInfo().GetDeclaredMethod(nameof(A.C.Func)).MakeGenericMethod(typeof(A.B <A.D>));

            var xml = generator.GenerateXml(new[] { methodInfo });

            Assert.Contains("<Type Name=\"A.C\" Dynamic=\"Required All\">", xml);
            Assert.Contains("<MethodInstantiation Name=\"Func\" Arguments=\"A.B{A.D}\" Dynamic=\"Required\" />", xml);
        }
        public void DoesNotDuplicateMethodInstantiations()
        {
            var generator  = new DirectiveGenerator();
            var methodInfo = typeof(A.C).GetTypeInfo().GetDeclaredMethod(nameof(A.C.Func)).MakeGenericMethod(typeof(A.D));

            var xml = generator.GenerateXml(new[] { methodInfo, methodInfo });

            var expectedDirective = "<MethodInstantiation Name=\"Func\" Arguments=\"A.D\" Dynamic=\"Required\" />";

            Assert.Equal(xml.LastIndexOf(expectedDirective), xml.IndexOf(expectedDirective));
        }