public async Task Launchpads_Get_By_Id_Mock() { // arrange var mockService = new Mock <ILaunchDataService>(); Launchpad launchpad = new Launchpad { Id = "xxx-yyyy-zzz", Name = "Test Launchpad", Status = "active" }; mockService.Setup(s => s.GetLaunchpadDataById("xxx-yyyy-zzz")) .Returns(Task.FromResult(launchpad)); var controller = new LaunchesController(mockService.Object); // act var result = await controller.GetLaunchpadById("xxx-yyyy-zzz"); // assert var okResult = result.Should().BeOfType <OkObjectResult>().Subject; var actual = okResult.Value.Should().BeAssignableTo <Launchpad>().Subject; actual.Id.Should().Be("xxx-yyyy-zzz"); }
public async Task Launchpads_Get_By_Id() { // arrange var controller = new LaunchesController(new LaunchDataService(new GetLaunchData())); // act var result = await controller.GetLaunchpadById("ccafs_slc_40"); // assert var okResult = result.Should().BeOfType <OkObjectResult>().Subject; }