public void GetAsync_is_guarded_against_null_selector(HubSpotDealConnector sut)
        {
            //Arrange

            //Act

            //Assert
            Assert.ThrowsAsync <ArgumentNullException>(async() => await sut.GetAsync <HubSpot.Deals.Deal>(null));
        }
        public async Task GetAsync_returns_null_if_deal_retrieving_throws_NotFoundException([Frozen] IHubSpotClient hubSpotClient, [Frozen] IDealSelector dealSelector, HubSpotDealConnector sut, NotFoundException notFoundException)
        {
            //Arrange
            Mock.Get(dealSelector).Setup(x => x.GetDeal(hubSpotClient)).Throws(notFoundException);

            //Act
            var result = await sut.GetAsync <HubSpot.Deals.Deal>(dealSelector);

            //Assert
            Assert.That(result, Is.Null);
        }
        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 async Task GetAsync_invokes_selector_from_parameters_to_retrieve_deal([Frozen] IHubSpotClient hubSpotClient, [Frozen] IDealSelector dealSelector, HubSpotDealConnector sut)
        {
            //Arrange

            //Act
            await sut.GetAsync <HubSpot.Deals.Deal>(dealSelector);

            //Assert
            Mock.Get(dealSelector).Verify(x => x.GetDeal(hubSpotClient), Times.Once);
        }