예제 #1
0
        public async Task GetAsync_ShouldReturnNotFoundGivenNoAddress()
        {
            this._addressService.Setup(x => x.GetAsync(It.IsAny <int>())).ReturnsAsync(default(Address));
            var controller = new AddressController(this._addressService.Object);

            var actionResult = await controller.GetAsync(It.IsAny <int>());

            actionResult.Result.Should().BeOfType <NotFoundResult>();
        }
예제 #2
0
        public async Task GetAsync_ShouldReturnAddress()
        {
            var fixture = new Fixture();
            var address = fixture.Create <Address>();

            this._addressService.Setup(x => x.GetAsync(It.IsAny <int>())).ReturnsAsync(address);
            var controller = new AddressController(this._addressService.Object);

            var actionResult = await controller.GetAsync(It.IsAny <int>());

            actionResult.Should().BeOfType <ActionResult <Address> >();
        }