public void GetPreviousMonthReading_GiveTenantIdMonth_GetPreviousReading() { //Arrange var tenantid = 1; var previousMonthReading = 40; var time = new DateTime(2020, 3, 7); var previousMonth = time.Month - 2; _billUnitOfWorkMock.Setup(x => x.ReadingRepository).Returns(_readingRepositoryMock.Object); // _readingRepositoryMock.Setup(x => x.GetPreviousMonthReading(tenantid, previousMonth)).Returns(previousMonthReading); // Act _readingService.GetPreviousMonthReading(tenantid, time); //Assert _billRepositoryMock.VerifyAll(); _readingRepositoryMock.VerifyAll(); _billUnitOfWorkMock.VerifyAll(); }