public async Task Then_The_Api_Is_Not_Called_If_Empty_Guid_And_Zero_Returned( [Frozen] Mock <ICourseDeliveryApiClient <CourseDeliveryApiConfiguration> > client, ShortlistService service) { //Act var actual = await service.GetShortlistItemCount(Guid.Empty); //Assert actual.Should().Be(0); client.Verify(x => x.Get <GetShortlistUserItemCountResponse>( It.IsAny <GetShortlistUserItemCountRequest>()), Times.Never); }
public async Task Then_If_There_Is_No_Shortlist_Zero_Is_Returned( Guid userId, [Frozen] Mock <ICourseDeliveryApiClient <CourseDeliveryApiConfiguration> > client, ShortlistService service) { //Arrange client .Setup(x => x.Get <GetShortlistUserItemCountResponse>( It.Is <GetShortlistUserItemCountRequest>(c => c.GetUrl.Contains(userId.ToString())))) .ReturnsAsync((GetShortlistUserItemCountResponse)null); //Act var actual = await service.GetShortlistItemCount(userId); //Assert actual.Should().Be(0); }
public async Task Then_The_Api_Is_Called_And_Shortlist_Items_Returned_For_User( Guid userId, GetShortlistUserItemCountResponse shortlistResponse, [Frozen] Mock <ICourseDeliveryApiClient <CourseDeliveryApiConfiguration> > client, ShortlistService service) { //Arrange client .Setup(x => x.Get <GetShortlistUserItemCountResponse>( It.Is <GetShortlistUserItemCountRequest>(c => c.GetUrl.Contains(userId.ToString())))) .ReturnsAsync(shortlistResponse); //Act var actual = await service.GetShortlistItemCount(userId); //Assert actual.Should().Be(shortlistResponse.Count); }