Exemple #1
0
        public void GetPriorityString_ReturnsRequired_WhenParameterHasNoDefault()
        {
            var service = new ParameterService();
            var pi      = typeof(ParameterServiceTests)
                          .GetMethod("FakeMethod")
                          .GetParameters()[1];

            var actual   = service.GetPriorityString(pi);
            var expected = "Required";

            Assert.AreEqual(expected, actual);
        }
Exemple #2
0
        public void GetPriorityString_ReturnsOptional_WhenParameterHasDefaultValue()
        {
            var service = new ParameterService();
            var pi      = typeof(ParameterServiceTests)
                          .GetMethod("FakeMethod")
                          .GetParameters()[2];

            var actual   = service.GetPriorityString(pi);
            var expected = "Optional";

            Assert.AreEqual(expected, actual);
        }
Exemple #3
0
        public void GetPriorityString_ReturnsOptionalAndDefault_WhenParameterHasDefaultAndVerboseFlagSetAndDefaultIsNull()
        {
            var mockSettings = new Mock <ISettings>();

            mockSettings.Setup(s => s.ParamDetail()).Returns("detailed");

            var service = new ParameterService(mockSettings.Object);
            var pi      = typeof(ParameterServiceTests)
                          .GetMethod("FakeMethod")
                          .GetParameters()[3];

            var actual   = service.GetPriorityString(pi);
            var expected = "Optional with a default value of null";

            Assert.AreEqual(expected, actual);
        }