public void BlankCreatePdfAsync_WithFatherName_ReturnsByteArray(string userId) { // Arrange _repository .Setup(x => x.User.GetFirstOrDefaultAsync(It.IsAny <Expression <Func <User, bool> > >(), It.IsAny <Func <IQueryable <User>, IIncludableQueryable <User, object> > >())) .ReturnsAsync(GetUserWithFatherName(userId)); _repository.Setup(x => x.UserProfile.GetFirstOrDefaultAsync(It.IsAny <Expression <Func <UserProfile, bool> > >(), null)) .ReturnsAsync(new UserProfile()); _repository .Setup(x => x.CityMembers.GetFirstOrDefaultAsync(It.IsAny <Expression <Func <CityMembers, bool> > >(), It.IsAny <Func <IQueryable <CityMembers>, IIncludableQueryable <CityMembers, object> > >())) .ReturnsAsync(new CityMembers()); _repository .Setup(x => x.ClubMembers.GetFirstOrDefaultAsync(It.IsAny <Expression <Func <ClubMembers, bool> > >(), It.IsAny <Func <IQueryable <ClubMembers>, IIncludableQueryable <ClubMembers, object> > >())) .ReturnsAsync(new ClubMembers()); // Act var actualReturn = _pdfService.BlankCreatePDFAsync(userId); // Assert _repository.Verify(); Assert.IsInstanceOf <byte[]>(actualReturn.Result); }
public void BlankCreatePdfAsync_ReturnsByteArray_Test(string userId) { _repository.Setup(repo => repo.User.GetFirstOrDefaultAsync(It.IsAny <Expression <Func <User, bool> > >(), It.IsAny <Func <IQueryable <User>, IIncludableQueryable <User, object> > >())) .ReturnsAsync(new User() { Id = userId }); var actualReturn = _pdfService.BlankCreatePDFAsync(userId); _repository.Verify(); Assert.IsInstanceOf <string>(actualReturn.Result); }