예제 #1
0
        public static void GetComment_WhenMemberContainsNoNameAttribute_ReturnsNull()
        {
            var doc      = XDocument.Parse("<doc><member></member></doc>");
            var type     = typeof(ReflectionCommentProvider);
            var provider = new ReflectionCommentProvider(doc);
            var comment  = provider.GetComment(type);

            Assert.That(comment, Is.Null);
        }
예제 #2
0
        public static void GetComment_WhenIncorrectDocumentProvided_ReturnsNull()
        {
            var doc      = XDocument.Parse("<a></a>");
            var type     = typeof(ReflectionCommentProvider);
            var provider = new ReflectionCommentProvider(doc);
            var comment  = provider.GetComment(type);

            Assert.That(comment, Is.Null);
        }
예제 #3
0
        public static void GetComment_WhenIdentifierNotPresent_ReturnsNull()
        {
            var doc      = XDocument.Parse("<doc><member name=\"T:A.B.C\"><summary></summary></member></doc>");
            var type     = typeof(ReflectionCommentProvider);
            var provider = new ReflectionCommentProvider(doc);
            var comment  = provider.GetComment(type);

            Assert.That(comment, Is.Null);
        }
예제 #4
0
        public static void GetComment_WhenMemberFoundButNoSummaryPresent_ReturnsNull()
        {
            var type         = typeof(ReflectionCommentProvider);
            var fakeProvider = new FakeReflectionCommentProvider();
            var identifier   = fakeProvider.GetIdentifier(type);
            var doc          = XDocument.Parse($"<doc><member name=\"{ identifier }\"></member></doc>");
            var provider     = new ReflectionCommentProvider(doc);
            var comment      = provider.GetComment(type);

            Assert.That(comment, Is.Null);
        }
예제 #5
0
        public static void GetComment_WhenMemberAndSummaryPresent_ReturnsCorrectSummaryValue()
        {
            var          type         = typeof(ReflectionCommentProvider);
            var          fakeProvider = new FakeReflectionCommentProvider();
            var          identifier   = fakeProvider.GetIdentifier(type);
            const string testSummary  = "this is a test comment";
            var          doc          = XDocument.Parse($"<doc><member name=\"{ identifier }\"><summary>{ testSummary }</summary></member></doc>");
            var          provider     = new ReflectionCommentProvider(doc);
            var          comment      = provider.GetComment(type);

            Assert.That(comment, Is.EqualTo(testSummary));
        }