public void Then_The_Fields_Are_Mapped(GetApiProductSubscriptionsQueryResult source, string name) { source.Subscriptions.First().Name = name; source.Products.First().Id = name; var actual = (ProductSubscriptionsApiResponse)source; actual.Should().BeEquivalentTo(source, options => options.Excluding(c => c.Subscriptions).ExcludingMissingMembers()); actual.Products.FirstOrDefault(c => c.Id.Equals(name))?.Key.Should().Be(source.Subscriptions.First().Key); }
public async Task Then_The_Request_Is_Handled_And_Data_Returned( string accountType, string accountIdentifier, GetApiProductSubscriptionsQueryResult mediatorResult, [Frozen] Mock <IMediator> mediator, [Greedy] SubscriptionsController controller) { mediator.Setup(x => x.Send(It.Is <GetApiProductSubscriptionsQuery>(c => c.AccountType.Equals(accountType) && c.AccountIdentifier.Equals(accountIdentifier) ), CancellationToken.None)).ReturnsAsync(mediatorResult); var actual = await controller.GetAvailableProducts(accountIdentifier, accountType) as OkObjectResult; Assert.IsNotNull(actual); var actualModel = actual.Value as ProductSubscriptionsApiResponse; Assert.IsNotNull(actualModel); }