public async Task GetById_RetrievesSuccessfully()
        {
            const string id = "12345";

            _launchpadRepository.Setup(mock => mock.GetByIdAsync(id)).ReturnsAsync(DataGeneration.GenerateLaunchpad());

            var svcResult = await GetService().GetByIdAsync(id);

            svcResult.Should().NotBeNull();

            VerifyAll();
        }
        public async Task GetAll_WithKeywordFilterNoMatch_ReturnsEmpty()
        {
            var launchpads = new List <LaunchpadViewModel>()
            {
                DataGeneration.GenerateLaunchpad(name: "Common Name"),
                DataGeneration.GenerateLaunchpad(name: "This is in Common"),
                DataGeneration.GenerateLaunchpad(name: "Nope, don't return this"),
            };

            _launchpadRepository.Setup(mock => mock.GetAllAsync()).ReturnsAsync(launchpads);

            var svcResult = await GetService().GetAllAsync(new string[] { "tacos" });

            svcResult.Count().Should().Be(0);

            VerifyAll();
        }
        public async Task GetAll_WithMultipleKeywordFilterMatch_Success()
        {
            var launchpads = new List <LaunchpadViewModel>()
            {
                DataGeneration.GenerateLaunchpad(name: "Common Name"),
                DataGeneration.GenerateLaunchpad(name: "This is in Common"),
                DataGeneration.GenerateLaunchpad(name: "Maybe this one should return"),
            };

            _launchpadRepository.Setup(mock => mock.GetAllAsync()).ReturnsAsync(launchpads);

            var svcResult = await GetService().GetAllAsync(new string[] { "common", "should" });

            svcResult.Count().Should().Be(3);

            VerifyAll();
        }
        public async Task GetAll_WithStatusFilterNoMatch_ReturnsEmpty()
        {
            var launchpads = new List <LaunchpadViewModel>()
            {
                DataGeneration.GenerateLaunchpad(status: "active"),
                DataGeneration.GenerateLaunchpad(status: "active"),
                DataGeneration.GenerateLaunchpad(status: "under construction"),
            };

            _launchpadRepository.Setup(mock => mock.GetAllAsync()).ReturnsAsync(launchpads);

            var svcResult = await GetService().GetAllAsync(new string[] { "retired" });

            svcResult.Count().Should().Be(0);

            VerifyAll();
        }
        public async Task GetAll_WithStatusAndNameFilterMatch_Success()
        {
            var launchpads = new List <LaunchpadViewModel>()
            {
                DataGeneration.GenerateLaunchpad(status: "active"),
                DataGeneration.GenerateLaunchpad(status: "active"),
                DataGeneration.GenerateLaunchpad(status: "under construction", name: "Taco and Burrito Launchpad"),
                DataGeneration.GenerateLaunchpad(status: "under construction"),
            };

            _launchpadRepository.Setup(mock => mock.GetAllAsync()).ReturnsAsync(launchpads);

            var svcResult = await GetService().GetAllAsync(new string[] { "active", "taco" });

            svcResult.Count().Should().Be(3);

            VerifyAll();
        }
        public async void GetAllById_ReturnsSingleLaunchpad()
        {
            var id = "abc_342";
            LaunchpadViewModel lp = DataGeneration.GenerateLaunchpad();

            lp.Id = id;
            _launchpadRetrievalServices.Setup(mock => mock.GetByIdAsync(id)).ReturnsAsync(lp);

            var response = await GetController().GetById(id);

            response.Result.Should().BeOfType <OkObjectResult>();
            var result = (OkObjectResult)response.Result;

            result.Value.Should().NotBeNull();
            result.Value.Should().BeOfType <LaunchpadViewModel>();
            var launchpad = (LaunchpadViewModel)result.Value;

            launchpad.Id.Should().Be(id);

            VerifyAll();
        }
        public async Task GetByIdAsync_ParsesJsonAndReturnsObject()
        {
            const string id = "34343";

            SetupRestAPIReturn();
            _deserializer.Setup(mock => mock.DeserializeLaunchpadResponse(EXAMPLE_JSON)).Returns(DataGeneration.GenerateLaunchpad());

            var launchpads = await GetRepository().GetByIdAsync(id);

            launchpads.Should().NotBeNull();

            VerifyAll();
        }