Esempio n. 1
0
        public void ExtractParameterOrDefaultFromDictionary_ReturnsDefaultTypeValueIfNoMatchAndNoDefaultParameterValue()
        {
            // Arrange
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            // Act
            object value = ActionDescriptor.ExtractParameterOrDefaultFromDictionary(ParameterExtractionController.IntParameter, dictionary);

            // Assert
            Assert.AreEqual(0, value);
        }
Esempio n. 2
0
        public void ExtractParameterOrDefaultFromDictionary_ReturnsDictionaryValueIfTypeMatch()
        {
            // Arrange
            Dictionary <string, object> dictionary = new Dictionary <string, object>()
            {
                { "stringParameterNoDefaultValue", "someValue" }
            };

            // Act
            object value = ActionDescriptor.ExtractParameterOrDefaultFromDictionary(ParameterExtractionController.StringParameterNoDefaultValue, dictionary);

            // Assert
            Assert.AreEqual("someValue", value);
        }
Esempio n. 3
0
        public void ExtractParameterOrDefaultFromDictionary_ReturnsDefaultParameterValueIfMismatch()
        {
            // Arrange
            Dictionary <string, object> dictionary = new Dictionary <string, object>()
            {
                { "stringParameterWithDefaultValue", 42 }
            };

            // Act
            object value = ActionDescriptor.ExtractParameterOrDefaultFromDictionary(ParameterExtractionController.StringParameterWithDefaultValue, dictionary);

            // Assert
            Assert.AreEqual("hello", value);
        }