public void HouseholdRepository_ShouldCallGetFirstOnce_WhenGetHouseholdIsCalled() { // Arrange var householdService = new HouseholdService(unitOfWorkMock.Object, householdRepoMock.Object, userRepoMock.Object, householdFactoryMock.Object); // Act householdService.GetHousehold(new Guid()); // Assert this.householdRepoMock.Verify(x => x.GetFirst(It.IsAny <Expression <Func <Household, bool> > >(), It.IsAny <Expression <Func <Household, object> > >()), Times.Once); }
public void GetHousehold_ShouldReturnInstanceOfHousehold_WhenCalled() { // Arrange var householdStub = new Household("_", "_", new byte[0]); householdRepoMock.Setup(x => x.GetFirst(It.IsAny <Expression <Func <Household, bool> > >(), It.IsAny <Expression <Func <Household, object> > >())).Returns(householdStub); var householdService = new HouseholdService(unitOfWorkMock.Object, householdRepoMock.Object, userRepoMock.Object, householdFactoryMock.Object); // Act var result = householdService.GetHousehold(new Guid()); // Assert Assert.IsInstanceOf <Household>(result); }