Exemplo n.º 1
0
        public async Task Counter_Report_All()
        {
            _consumptionRepository = new MockConsumptionRepository();
            _counterRepository     = new MockCounterRepository();
            _counterService        = new CounterService(_counterRepository, _consumptionRepository);
            _controller            = new CounterController(_counterService);

            await _controller.CounterCallback(1, 250);

            await _controller.CounterCallback(1, 240);

            await _controller.CounterCallback(2, 2444);

            var result = await _controller.ConsumptionReport("24");

            var okResult = result.Should().BeOfType <OkObjectResult>().Subject;

            var subject = okResult.Value.Should().BeAssignableTo <TotalVillageReportWrapperViewModel>().Subject;

            subject.Villages.Count().Should().Be(2);

            subject.Villages[0].Consumption.Should().Be(490);
            subject.Villages[1].Consumption.Should().Be(2444);
        }