public void GetComments_Method()
        {
            IFile fileProxy = MockRepository.GenerateMock <IFile>();
            IXmlDocCommentReadPolicy readPolicy = MockRepository.GenerateMock <IXmlDocCommentReadPolicy>();

            MethodInfo expectedMethod   = MethodInfo.GetCurrentMethod() as MethodInfo;
            XElement   expectedComments = new XElement("comments");

            fileProxy.Expect(fp => fp.Exists(String.Empty)).Return(true);
            readPolicy.Expect(rp => rp.ReadMember(Convert.ToXmlDocCommentMember(expectedMethod))).Return(expectedComments);

            XmlDocCommentReader reader = new XmlDocCommentReader(String.Empty, fileProxy, readPolicy);

            Assert.That(reader.GetComments(expectedMethod), Is.SameAs(expectedComments));

            fileProxy.VerifyAllExpectations();
            readPolicy.VerifyAllExpectations();
        }
        public void GetComments_Field()
        {
            IFile fileProxy = MockRepository.GenerateMock <IFile>();
            IXmlDocCommentReadPolicy readPolicy = MockRepository.GenerateMock <IXmlDocCommentReadPolicy>();

            FieldInfo expectedField    = typeof(Int32).GetField("MaxValue", BindingFlags.Public | BindingFlags.Static);
            XElement  expectedComments = new XElement("comments");

            fileProxy.Expect(fp => fp.Exists(String.Empty)).Return(true);
            readPolicy.Expect(rp => rp.ReadMember(Convert.ToXmlDocCommentMember(expectedField))).Return(expectedComments);

            XmlDocCommentReader reader = new XmlDocCommentReader(String.Empty, fileProxy, readPolicy);

            Assert.That(reader.GetComments(expectedField), Is.SameAs(expectedComments));

            fileProxy.VerifyAllExpectations();
            readPolicy.VerifyAllExpectations();
        }
        public void GetComments_Property()
        {
            IFile fileProxy = MockRepository.GenerateMock <IFile>();
            IXmlDocCommentReadPolicy readPolicy = MockRepository.GenerateMock <IXmlDocCommentReadPolicy>();

            PropertyInfo expectedProperty = typeof(Array).GetProperty("Length");
            XElement     expectedComments = new XElement("comments");

            fileProxy.Expect(fp => fp.Exists(String.Empty)).Return(true);
            readPolicy.Expect(rp => rp.ReadMember(Convert.ToXmlDocCommentMember(expectedProperty))).Return(expectedComments);

            XmlDocCommentReader reader = new XmlDocCommentReader(String.Empty, fileProxy, readPolicy);

            Assert.That(reader.GetComments(expectedProperty), Is.SameAs(expectedComments));

            fileProxy.VerifyAllExpectations();
            readPolicy.VerifyAllExpectations();
        }
        public void GetComments_Event()
        {
            IFile fileProxy = MockRepository.GenerateMock <IFile>();
            IXmlDocCommentReadPolicy readPolicy = MockRepository.GenerateMock <IXmlDocCommentReadPolicy>();

            EventInfo expectedEvent    = typeof(Console).GetEvent("CancelKeyPress");
            XElement  expectedComments = new XElement("comments");

            fileProxy.Expect(fp => fp.Exists(String.Empty)).Return(true);
            readPolicy.Expect(rp => rp.ReadMember(Convert.ToXmlDocCommentMember(expectedEvent))).Return(expectedComments);

            XmlDocCommentReader reader = new XmlDocCommentReader(String.Empty, fileProxy, readPolicy);

            Assert.That(reader.GetComments(expectedEvent), Is.SameAs(expectedComments));

            fileProxy.VerifyAllExpectations();
            readPolicy.VerifyAllExpectations();
        }