Exemplo n.º 1
0
        public void Output_binding_summary_for_dictionary_value_list_as_expected(bool isMappedValue, string expectedSummary)
        {
            var request  = new TestRequest();
            var response = new TestResponse();

            var responseType     = response.GetType().GetFlowObjectType();
            var responseProperty = responseType[nameof(TestResponse.OutputStrings)];

            var outputBinding = new FlowValueOutputBinding(responseProperty)
            {
                FlowValueSelector = new FlowValueListSelector("DictionaryValue1", "DictionaryValue2"),
                MapValue          = isMappedValue ? v => v : (Func <object, object>)null,
            };

            var summary = outputBinding.GetSummary(request);

            Assert.Equal(expectedSummary, summary);
        }
Exemplo n.º 2
0
        public void Output_binding_summary_for_single_value_as_expected(bool isMappedValue, string expectedSummary)
        {
            var request  = new TestRequest();
            var response = new TestResponse();

            var responseType     = response.GetType().GetFlowObjectType();
            var responseProperty = responseType[nameof(TestResponse.OutputInt)];

            var outputBinding = new FlowValueOutputBinding(responseProperty)
            {
                MapName  = (n, r) => "FlowInt",
                MapValue = isMappedValue ? v => v : (Func <object, object>)null,
            };

            var summary = outputBinding.GetSummary(request);

            Assert.Equal(expectedSummary, summary);
        }
Exemplo n.º 3
0
        public void Output_binding_summary_for_dictionary_regex_name_as_expected(bool isMappedValue, bool isMappedName, string expectedSummary)
        {
            var request  = new TestRequest();
            var response = new TestResponse();

            var responseType     = response.GetType().GetFlowObjectType();
            var responseProperty = responseType[nameof(TestResponse.OutputStrings)];

            var outputBinding = new FlowValueOutputBinding(responseProperty)
            {
                FlowValueSelector =
                    new FlowValueRegexSelector("^FlowValue.*", isMappedName ? n => n : (Func <string, string>)null),
                MapValue = isMappedValue ? v => v : (Func <object, object>)null,
            };

            var summary = outputBinding.GetSummary(request);

            Assert.Equal(expectedSummary, summary);
        }