Exemple #1
0
        public void OptionsHasFiltersIfStatusIsSpecified()
        {
            LaunchPadFilterOptions options = new LaunchPadFilterOptions
            {
                Status = "Active"
            };

            Assert.IsTrue(options.HasFilters(), "The options object should have filters; the status was specified.");
        }
Exemple #2
0
        public void OptionsHasFiltersIfFullNameIsSpecified()
        {
            LaunchPadFilterOptions options = new LaunchPadFilterOptions
            {
                FullName = "Test"
            };

            Assert.IsTrue(options.HasFilters(), "The options object should have filters; the full name was specified.");
        }
Exemple #3
0
        public void OptionsHasFiltersIfStatusAndFullNameAreSpecified()
        {
            LaunchPadFilterOptions options = new LaunchPadFilterOptions
            {
                FullName = "Test",
                Status   = "Active"
            };

            Assert.IsTrue(options.HasFilters(), "The options object should have filters; the status and full name were specified.");
        }
Exemple #4
0
        public void OptionsDoesNotHaveFiltersIfFiltersAreEmpty()
        {
            LaunchPadFilterOptions options = new LaunchPadFilterOptions
            {
                FullName = string.Empty,
                Status   = string.Empty
            };

            Assert.IsFalse(options.HasFilters(), "Filters were empty, the options object should not have filters.");
        }
Exemple #5
0
        public async Task <List <LaunchPad> > GetFilteredLaunchPads(LaunchPadFilterOptions options)
        {
            List <LaunchPad> toReturn = await GetAllLaunchPads();

            if (options?.HasFilters() != true)
            {
                _logger.LogDebug("No filtering necessary; no filters were supplied.");

                return(toReturn);
            }

            _logger.LogDebug($"Applying filters. FullName = {options.FullName}, status = {options.Status}");

            toReturn = toReturn.Where(l =>
            {
                return((options.FullName == null || l.FullName.Contains(options.FullName, StringComparison.InvariantCultureIgnoreCase)) &&
                       (options.Status == null || l.Status.Contains(options.Status, StringComparison.InvariantCultureIgnoreCase)));
            }).ToList();

            return(toReturn);
        }
Exemple #6
0
        public void OptionsDoesNotHaveFiltersIfNoFiltersAreSpecified()
        {
            LaunchPadFilterOptions options = new LaunchPadFilterOptions();

            Assert.IsFalse(options.HasFilters(), "No filters were specified, it should not have filters.");
        }