コード例 #1
0
        public async void HandleAsync_GivenRequest_DataAccessShouldBeCalled()
        {
            var id = Guid.NewGuid();

            await handler.HandleAsync(new GetAatfSite(id, id));

            A.CallTo(() => dataAccess.GetAddresses(id, id)).MustHaveHappened(Repeated.Exactly.Once);
        }
コード例 #2
0
        public async Task HandleAsync_NoExternalAccess_ThrowsSecurityException()
        {
            var authorization = new AuthorizationBuilder().DenyExternalAreaAccess().Build();

            var handler = new GetAatfSiteHandler(authorization, dataAccess, mapper);

            Func <Task> action = async() => await handler.HandleAsync(A.Dummy <GetAatfSite>());

            await action.Should().ThrowAsync <SecurityException>();
        }