Esempio n. 1
0
        public async void ControllerDelegatesRequestsToDownStreamServicesWhenRequestIsValid()
        {
            var mockApiService = new Mock <IBoqApiService>();

            mockApiService.Setup(api => api.GetSession(It.IsAny <int>()));

            var controller = new DemoController(mockApiService.Object);
            await controller.GetSession(1);

            mockApiService.Verify(mock => mock.GetSession(It.IsAny <int>()), Times.Once);
        }
Esempio n. 2
0
        public void ControllerThrowsErrorForInvalidSessionId()
        {
            var controller = new DemoController(null);

            Assert.ThrowsAsync <InvalidSessionError>(async() => await controller.GetSession(-1));
        }