public void IsValid_RertunsFalse_WhenPageSizeIsLessThan1()
        {
            var filter = new LaunchpadFilter()
            {
                PageNumber = 1,
                PageSize   = 0
            };

            Assert.IsFalse(filter.IsValid());
        }
        public void IsValie_ReturnsFalse_WhenAllNamesAreNull()
        {
            var filter = new LaunchpadFilter()
            {
                LaunchpadNames = new List <string>()
                {
                    null
                }
            };

            Assert.IsFalse(filter.IsValid());
        }
Exemplo n.º 3
0
        public async Task <IActionResult> FilterLaunchpads(LaunchpadFilter filter)
        {
            filter = filter ?? new LaunchpadFilter();
            try
            {
                if (!filter.IsValid())
                {
                    return(BadRequest());
                }

                var launchPads = await this.launchpadService.FilterLaunchPads(filter);

                return(Ok(launchPads));
            }
            catch (Exception ex)
            {
                logger.LogError(ex, $"Unhandled error thrown while retrieving launchpad information with filter {filter}");
                throw;
            }
        }
        public void IsValid_ReturnsTrue_WhenFilterIsEmpty()
        {
            var filter = new LaunchpadFilter();

            Assert.IsTrue(filter.IsValid());
        }