public async Task GetAsync_returns_converted_deal([Frozen] IDealTypeManager dealTypeManager, [Frozen] IHubSpotClient hubSpotClient, [Frozen] IDealSelector dealSelector, HubSpot.Deals.Deal convertedDeal, HubSpotDealConnector sut, IFixture fixture) { //Arrange Mock.Get(dealTypeManager).Setup(x => x.ConvertTo <HubSpot.Deals.Deal>(It.IsAny <HubSpot.Model.Deals.Deal>())).Returns(convertedDeal); //Act var result = await sut.GetAsync <HubSpot.Deals.Deal>(dealSelector); //Assert Assert.That(result, Is.EqualTo(convertedDeal)); }
public async Task GetAsync_invokes_deal_type_manager_to_convert_selector_result([Frozen] IDealTypeManager dealTypeManager, [Frozen] IHubSpotClient hubSpotClient, [Frozen] IDealSelector dealSelector, HubSpotDealConnector sut, HubSpot.Model.Deals.Deal deal) { //Arrange Mock.Get(dealSelector).Setup(x => x.GetDeal(hubSpotClient)).Returns(Task.FromResult(deal)); //Act await sut.GetAsync <HubSpot.Deals.Deal>(dealSelector); //Assert Mock.Get(dealTypeManager).Verify(x => x.ConvertTo <HubSpot.Deals.Deal>(deal), Times.Once); }
public HubSpotDealConnector(IHubSpotClient client, IDealTypeManager typeManager) { _client = client ?? throw new ArgumentNullException(nameof(client)); _typeManager = typeManager ?? throw new ArgumentNullException(nameof(typeManager)); }