Esempio n. 1
0
        private void AssertIsNotAuthorized(string azureUniqueId)
        {
            var toDelete = CreateParticipant(
                evaluation: _evaluation,
                azureUniqueId: Randomize.Integer().ToString()
                );

            _authService.LoginUser(azureUniqueId);
            Assert.Throws <UnauthorizedAccessException>(() =>
                                                        _mutation.DeleteParticipant(toDelete.Id)
                                                        );
        }
Esempio n. 2
0
        /* Helper methods */

        private void AssertCanDelete(Participant user)
        {
            var toDelete = CreateParticipant(
                evaluation: _evaluation,
                azureUniqueId: Randomize.Integer().ToString()
                );

            _authService.LoginUser(user);
            int participants = NumberOfParticipants(_evaluation);

            _mutation.DeleteParticipant(toDelete.Id);
            Assert.True(NumberOfParticipants(_evaluation) == participants - 1);
        }
Esempio n. 3
0
        protected Participant CreateParticipant(
            Evaluation evaluation,
            string azureUniqueId      = null,
            Organization?organization = null,
            Role?role = null)
        {
            if (azureUniqueId == null)
            {
                azureUniqueId = Randomize.Integer().ToString();
            }

            Participant participant = _mutation.CreateParticipant(
                azureUniqueId: azureUniqueId,
                evaluationId: evaluation.Id,
                organization: organization.GetValueOrDefault(Randomize.Organization()),
                role: role.GetValueOrDefault(Randomize.Role())
                );

            return(participant);
        }
Esempio n. 4
0
        public void NonParcipantIsUnauthorized()
        {
            string AzureUniqueId = Randomize.Integer().ToString();

            AssertIsNotAuthorized(AzureUniqueId);
        }