コード例 #1
0
        public async Task Counter_Get_One()
        {
            _consumptionRepository = new MockConsumptionRepository();
            _counterRepository     = new MockCounterRepository();
            _counterService        = new CounterService(_counterRepository, _consumptionRepository);
            _controller            = new CounterController(_counterService);

            var result = await _controller.Counter(1);

            // Assert
            var okResult = result.Should().BeOfType <OkObjectResult>().Subject;
            var subject  = okResult.Value.Should().BeAssignableTo <SlimCounterViewModel>().Subject;

            subject.Id.Should().Be("1");
            subject.VillageName.Should().Be("TestVillage1");
        }