Beispiel #1
0
        public void GetMonthlySummaries_Should_Return_ResultOfCallingAppropriateServices()
        {
            // arrange
            MockFilePathProvider.Setup(x => x.GetPath()).Returns("path");
            var meterReadings = new List <MeterReading>();

            MockRepo.Setup(x => x.GetMeterReadings("path")).Returns(meterReadings);
            var monthlyData = new List <MonthlySummary>();

            MockAggregateService.Setup(x => x.GetMonthlyData(meterReadings)).Returns(monthlyData);

            // act
            var result = SystemUnderTest.GetMonthlySummaries();

            // assert
            Assert.Equal(monthlyData, result.Value);
            Assert.Equal(ResultCode.Ok, result.ResultCode);
        }
Beispiel #2
0
        public void GetUsageForDates_Should_Return_ResultOfCallingAppropriateServices()
        {
            // arrange
            MockFilePathProvider.Setup(x => x.GetPath()).Returns("path");
            var meterReadings = new List <MeterReading>();

            MockRepo.Setup(x => x.GetMeterReadings("path")).Returns(meterReadings);
            var usage     = 2;
            var startDate = new DateTime();
            var endDate   = new DateTime();

            MockAggregateService.Setup(x => x.GetUsageBetweenDates(meterReadings, startDate, endDate)).Returns(usage);

            // act
            var result = SystemUnderTest.GetUsageForDates(startDate, endDate);

            // assert
            Assert.Equal(usage, result.Value);
            Assert.Equal(ResultCode.Ok, result.ResultCode);
        }