Exemple #1
0
        public void Get_ReturnsParsedBoolValue_WhenKeyIsFound()
        {
            var parameters = new ExecutableParameters(new Dictionary <string, string>()
            {
                { "mykey", "true" }
            });
            var value = parameters.Get <bool>("mykey");

            Assert.True(value);
        }
Exemple #2
0
        public void Get_ReturnsParsedIntValue_WhenKeyIsFound()
        {
            var parameters = new ExecutableParameters(new Dictionary <string, string>()
            {
                { "mykey", "156" }
            });
            var value = parameters.Get <int>("mykey");

            Assert.Equal(156, value);
        }
Exemple #3
0
        public void Get_ReturnsValue_WhenKeyIsFound()
        {
            var parameters = new ExecutableParameters(new Dictionary <string, string>()
            {
                { "mykey", "my_value" }
            });
            var value = parameters.Get("mykey");

            Assert.Equal("my_value", value);
        }
Exemple #4
0
        public void Get_ThrowsException_WhenValueNotCorrectFormat()
        {
            var parameters = new ExecutableParameters(new Dictionary <string, string>()
            {
                { "mykey", "not_an_integer" }
            });
            var exception = Record.Exception(() => parameters.Get <int>("mykey"));

            Assert.NotNull(exception);
            Assert.IsType <FormatException>(exception);
        }
Exemple #5
0
        public void Get_ThrowsException_WhenKeyIsNull()
        {
            var exception = Record.Exception(() => _emptyParameters.Get(null));

            Assert.NotNull(exception);
            Assert.IsType <ArgumentNullException>(exception);
        }