コード例 #1
0
        public void TOU_FileRecords_Test()
        {
            var mockDataReaderService = new Mock <ITOULineDataReaderService>()
            {
                CallBase = true
            };

            mockDataReaderService.Setup(x => x.ReadTOUFileLines(""))
            .Returns(FileDataCollection.MockTOUFileInputData());

            var lineReaderService = new TOUFileLineRecordService(new MedianService(), mockDataReaderService.Object);
            var fileRecords       = lineReaderService.GetFileLineRecords("");

            Assert.True(fileRecords != null);
            Assert.True(fileRecords.Count() == 3);
            Assert.Equal((decimal)0.004000, fileRecords.FirstOrDefault().ReadingMedianValue);
        }
コード例 #2
0
        public void ProcessReadingsService_Test()
        {
            //Arrange
            var mockDataRepository = new Mock <IRepository>()
            {
                CallBase = true
            };

            mockDataRepository.Setup(x => x.FetchAll(""))
            .Returns(FileDataCollection.GetFileMockInputData());

            //ACT SUT ProcessReadingsService
            var processReadingsService = new ProcessReadingsService(mockDataRepository.Object, new BusinessRules());
            var fileReadings           = processReadingsService.GetFileReadings("");

            //Assert
            Assert.True(fileReadings != null);
            Assert.True(fileReadings.Count() == 4);
            Assert.Equal(FileDataCollection.GetFileMockOutputData(), fileReadings);
        }