public void BuildMethodDescription_WhenMethodHasTwoArguments_TwoArgumentsAreReturned()
        {
            MethodInfo method = _testClass.GetMethod("PublicStringMethodWithTwoArguments");

            var builder = new MethodDescriptionBuilder(_xmlSource);
            MethodDescription description = builder.BuildMethodDescription(method);

            Assert.AreEqual(2, description.Arguments.Count);
        }
        public void BuildMethodDescription_WhenMethodHasNoReturnValue_ReturnValueIsNull()
        {
            MethodInfo method = _testClass.GetMethod("PublicVoidMethodWithoutArguments");

            var builder = new MethodDescriptionBuilder(_xmlSource);
            MethodDescription description = builder.BuildMethodDescription(method);

            Assert.IsNull(description.ReturnValue);
        }
        public void BuildMethodDescription_WhenInvoked_NameIsCorrectlySet()
        {
            MethodInfo method = _testClass.GetMethod("PublicVoidMethodWithoutArguments");

            var builder = new MethodDescriptionBuilder(_xmlSource);
            MethodDescription description = builder.BuildMethodDescription(method);

            Assert.AreEqual(method.Name, description.Name);
        }
        public void BuildMethodDescription_WhenMethodHasReturnValue_ReturnValueIsCorrect()
        {
            MethodInfo method = _testClass.GetMethod("PublicStringMethodWithNoArguments");

            var builder = new MethodDescriptionBuilder(_xmlSource);
            MethodDescription description = builder.BuildMethodDescription(method);
            ReturnValueDescription returnValue = description.ReturnValue;

            Assert.AreEqual("String", returnValue.TypeName);
        }
        public void BuildMethodDescription_WhenMethodHasArguments_ArgumentsAreCorrectlyDescribed()
        {
            MethodInfo method = _testClass.GetMethod("PublicStringMethodWithTwoArguments");

            var builder = new MethodDescriptionBuilder(_xmlSource);
            MethodDescription description = builder.BuildMethodDescription(method);

            ArgumentDescription argument = description.Arguments[0];

            Assert.AreEqual("DateTime", argument.ArgumentType);
            Assert.AreEqual("time", argument.ArgumentName);
        }
Esempio n. 6
0
 public void Setup()
 {
     builder = new MethodDescriptionBuilder();
 }
        public void BuildMethodDescription_WhenXmlHasArgumentDescription_DescriptionIsIncluded()
        {
            MethodInfo method = _testClass.GetMethod("PublicStringMethodWithTwoArguments");

            var builder = new MethodDescriptionBuilder(_xmlSource);
            MethodDescription description = builder.BuildMethodDescription(method);

            ArgumentDescription argument = description.Arguments[0];

            Assert.IsTrue(argument.Description.Length > 0);
        }
        public void BuildMethodDescription_WhenReturnValueIsDescribed_DescriptionIsIncluded()
        {
            MethodInfo method = _testClass.GetMethod("PublicStringMethodWithTwoArguments");

            var builder = new MethodDescriptionBuilder(_xmlSource);
            MethodDescription description = builder.BuildMethodDescription(method);
            ReturnValueDescription returnValue = description.ReturnValue;

            Assert.IsTrue(returnValue.Description.Length > 0);
        }
        public void BuildMethodDescription_WhenXmlSourceContainsSummary_SummaryIsPopulated()
        {
            MethodInfo method = _testClass.GetMethod("PublicVoidMethodWithoutArguments");

            var builder = new MethodDescriptionBuilder(_xmlSource);
            MethodDescription description = builder.BuildMethodDescription(method);

            Assert.IsNotNull(description.Summary);
        }