示例#1
0
        public void WhenQueryAttributeHasConverterThenParameterValueIsConverted()
        {
            var queryDecoder = new QueryDecoder();
            var parameters   = queryDecoder.GetParameters(new StubConverterQuery
            {
                Item1 = "1"
            });

            Assert.Equal("Converted", parameters["Item1"]);
        }
示例#2
0
        public void WhenQueryAttributeHasConverterThenParameterValueIsConverted()
        {
            var queryDecoder = new QueryDecoder();
            var parameters   = queryDecoder.GetParameters(new StubConverterQuery
            {
                StringItem = _stringItem1,
                DictItem   = 42
            });

            Assert.Equal(_converted, parameters[_stringItem1ApiField]);
            Assert.Equal(_dictValue1, parameters[$"{_dictItemApiField}.{_dictKey1}"]);
            Assert.Equal(_dictValue2, parameters[$"{_dictItemApiField}.{_dictKey2}"]);
            Assert.Equal(_dictValue3, parameters[$"{_dictItemApiField}.{_dictKey3}"]);
        }
示例#3
0
        public void WhenQueryPassedThenOnlyAPIFieldAttributesAreReturned()
        {
            var queryDecoder = new QueryDecoder();
            var parameters   = queryDecoder.GetParameters(new StubQuery
            {
                Item        = _item,
                StringItem1 = _stringItem1,
                StringItem2 = _stringItem2
            });

            // Unannotated property should not appear as it does not have APIField attribute
            Assert.Equal(2, parameters.Count);

            Assert.Equal(_stringItem1, parameters[_stringItem1ApiField]);
            Assert.Equal(_stringItem2, parameters[_stringItem2ApiField]);
        }
示例#4
0
        public void WhenQueryPassedThenOnlyAPIFieldAttributesAreReturned()
        {
            var queryDecoder = new QueryDecoder();
            var parameters   = queryDecoder.GetParameters(new StubQuery
            {
                Item1 = "1",
                Item2 = "2",
                Item3 = "3"
            });

            // Property Item3 should not appear as it does not have APIField attribute
            Assert.Equal(2, parameters.Count);

            Assert.Equal("1", parameters["Item1"]);
            Assert.Equal("2", parameters["Item2"]);
        }