示例#1
0
        public void GenerateXml_WithOverriddenMembers()
        {
            var mixinConfiguration = MixinConfiguration.BuildNew()
                                     .ForClass <TargetDoSomething>().AddMixin <MixinDoSomething>()
                                     .BuildConfiguration();

            var type1 = new InvolvedType(typeof(TargetDoSomething));

            type1.ClassContext = new ReflectedObject(mixinConfiguration.ClassContexts.First());

            var memberOverrides = GetMemberOverrides(type1, typeof(MixinDoSomething), mixinConfiguration);

            var reportGenerator = new MemberOverrideReportGenerator(memberOverrides);

            var output = reportGenerator.GenerateXml();

            var expectedOutput = new XElement(
                "MemberOverrides",
                new XElement(
                    "OverriddenMember",
                    new XAttribute("type", "Method"),
                    new XAttribute("name", "DoSomething")
                    ));

            Assert.That(output.ToString(), Is.EqualTo(expectedOutput.ToString()));
        }
示例#2
0
        public void GenerateXml_NoOverriddenMembers()
        {
            var mixinConfiguration = MixinConfiguration.BuildNew()
                                     .ForClass <TargetClass1>().AddMixin <Mixin1>()
                                     .BuildConfiguration();

            var type1 = new InvolvedType(typeof(TargetClass1));

            type1.ClassContext = new ReflectedObject(mixinConfiguration.ClassContexts.First());

            var memberOverrides = GetMemberOverrides(type1, typeof(Mixin1), mixinConfiguration);

            var reportGenerator = new MemberOverrideReportGenerator(memberOverrides);

            var output = reportGenerator.GenerateXml();

            var expectedOutput = new XElement("MemberOverrides");

            Assert.That(output.ToString(), Is.EqualTo(expectedOutput.ToString()));
        }