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

            await handler.HandleAsync(new GetAatfByOrganisation(id));

            A.CallTo(() => dataAccess.GetManyByExpression(A <AatfsByOrganisationSpecification> .That.Matches(c => c.OrganisationId == id))).MustHaveHappened(Repeated.Exactly.Once);
        }
コード例 #2
0
        public async void HandleAsync_NoOrganisationOrInternalAccess_ThrowsSecurityException()
        {
            var authorization = new AuthorizationBuilder().DenyInternalOrOrganisationAccess().Build();

            handler = new GetAatfInfoByOrganisationRequestHandler(A.Fake <IMap <Aatf, AatfData> >(), A.Fake <IGenericDataAccess>(), authorization);

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

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