public async Task VerifyOrganisationExistsAndIncompleteHandler_NotOrganisationUser_ThrowsSecurityException()
        {
            var authorization = AuthorizationBuilder.CreateUserDeniedFromAccessingOrganisation();

            var handler = new VerifyOrganisationExistsAndIncompleteHandler(authorization, A.Dummy<WeeeContext>());
            var message = new VerifyOrganisationExistsAndIncomplete(Guid.NewGuid());

            await Assert.ThrowsAsync<SecurityException>(async () => await handler.HandleAsync(message));
        }
Пример #2
0
        public async Task VerifyOrganisationExistsAndIncompleteHandler_NotOrganisationUser_ThrowsSecurityException()
        {
            var authorization = AuthorizationBuilder.CreateUserDeniedFromAccessingOrganisation();

            var handler = new VerifyOrganisationExistsAndIncompleteHandler(authorization, A.Dummy <WeeeContext>());
            var message = new VerifyOrganisationExistsAndIncomplete(Guid.NewGuid());

            await Assert.ThrowsAsync <SecurityException>(async() => await handler.HandleAsync(message));
        }
        public async Task VerifyOrganisationExistsAndIncompleteHandler_OrgDoesNotExists_ReturnsFalse()
        {
            var organisations = MakeOrganisation();
            organisations.FirstOrDefault().OrganisationStatus = OrganisationStatus.Incomplete;

            var context = A.Fake<WeeeContext>();

            A.CallTo(() => context.Organisations).Returns(organisations);

            var handler = new VerifyOrganisationExistsAndIncompleteHandler(permissiveAuthorization, context);

            var exists = await handler.HandleAsync(new VerifyOrganisationExistsAndIncomplete(Guid.NewGuid()));

            Assert.False(exists);
        }
        public async Task VerifyOrganisationExistsAndIncompleteHandler_OrgExistsAndApproved_ReturnsFalse()
        {
            var organisations = MakeOrganisation();

            var context = A.Fake<WeeeContext>();

            A.CallTo(() => context.Organisations).Returns(organisations);

            var handler = new VerifyOrganisationExistsAndIncompleteHandler(permissiveAuthorization, context);

            var exists =
                await handler.HandleAsync(new VerifyOrganisationExistsAndIncomplete(organisations.FirstOrDefault().Id));

            Assert.False(exists);
        }
Пример #5
0
        public async Task VerifyOrganisationExistsAndIncompleteHandler_OrgExistsAndApproved_ReturnsFalse()
        {
            var organisations = MakeOrganisation();

            var context = A.Fake <WeeeContext>();

            A.CallTo(() => context.Organisations).Returns(organisations);

            var handler = new VerifyOrganisationExistsAndIncompleteHandler(permissiveAuthorization, context);

            var exists =
                await handler.HandleAsync(new VerifyOrganisationExistsAndIncomplete(organisations.FirstOrDefault().Id));

            Assert.False(exists);
        }
Пример #6
0
        public async Task VerifyOrganisationExistsAndIncompleteHandler_OrgDoesNotExists_ReturnsFalse()
        {
            var organisations = MakeOrganisation();

            organisations.FirstOrDefault().OrganisationStatus = OrganisationStatus.Incomplete;

            var context = A.Fake <WeeeContext>();

            A.CallTo(() => context.Organisations).Returns(organisations);

            var handler = new VerifyOrganisationExistsAndIncompleteHandler(permissiveAuthorization, context);

            var exists = await handler.HandleAsync(new VerifyOrganisationExistsAndIncomplete(Guid.NewGuid()));

            Assert.False(exists);
        }