示例#1
0
        public async Task <IActionResult> List([FromQuery] ListFromQuery query)
        {
            var request = new ListRequest(query);

            var result = await _apiResult.Produce(request);

            return(result);
        }
示例#2
0
        public void ConstructorShouldFailWhenQueryIsNull()
        {
            // Arrange
            ListFromQuery query = null;

            // Act
            Action ctor = () => { new ListRequest(query); };

            // Assert
            ctor.Should().Throw <ArgumentNullException>();
        }
示例#3
0
        public void ConstructorShouldSucceed()
        {
            // Arrange
            var query = new ListFromQuery();


            // Act
            var obj = new ListRequest(query);

            // Assert
            obj.Should().NotBeNull();
        }
示例#4
0
        public void MemberQueryApiVersionShouldHaveCorrectValue()
        {
            // Arrange
            var apiVersion = "1.0";
            var query      = new ListFromQuery()
            {
                ApiVersion = apiVersion
            };

            // Act
            var obj = new ListRequest(query);

            // Assert
            obj.QueryApiVersion.Should().Be(apiVersion);
        }
示例#5
0
 public ListRequest(ListFromQuery query)
 {
     _query = query ?? throw new ArgumentNullException(nameof(query));
 }