public void DefaultInputFormatterSelectorTests_ReturnsFirstFormatterWhichReturnsTrue()
        {
            // Arrange
            var actionContext = GetActionContext();
            var inputFormatters = new List<IInputFormatter>()
            {
                new TestInputFormatter(false, 0),
                new TestInputFormatter(false, 1),
                new TestInputFormatter(true, 2),
                new TestInputFormatter(true, 3)
            };

            var context = new InputFormatterContext(actionContext, typeof(int));
            var selector = new DefaultInputFormatterSelector();

            // Act
            var selectedFormatter = selector.SelectFormatter(inputFormatters, context);

            // Assert
            var testFormatter = Assert.IsType<TestInputFormatter>(selectedFormatter);
            Assert.Equal(2, testFormatter.Index);
        }
Ejemplo n.º 2
0
        public void DefaultInputFormatterSelectorTests_ReturnsFirstFormatterWhichReturnsTrue()
        {
            // Arrange
            var actionContext   = GetActionContext();
            var inputFormatters = new List <IInputFormatter>()
            {
                new TestInputFormatter(false, 0),
                new TestInputFormatter(false, 1),
                new TestInputFormatter(true, 2),
                new TestInputFormatter(true, 3)
            };

            var context  = new InputFormatterContext(actionContext, typeof(int));
            var selector = new DefaultInputFormatterSelector();

            // Act
            var selectedFormatter = selector.SelectFormatter(inputFormatters, context);

            // Assert
            var testFormatter = Assert.IsType <TestInputFormatter>(selectedFormatter);

            Assert.Equal(2, testFormatter.Index);
        }