Esempio n. 1
0
        public void UpdateClient_should_throw_exception_if_client_is_not_found()
        {
            var command = new UpdateClient {
                Id = "ios", Name = "iOS"
            };

            Assert.Throws <DomainObjectNotFoundException>(() => GuardAppClients.CanUpdate(clients, command));
        }
Esempio n. 2
0
        public void UpdateClient_should_not_throw_exception_if_command_is_valid()
        {
            var command = new UpdateClient {
                Id = "ios", Name = "iOS", Permission = AppClientPermission.Reader
            };

            clients.Add("ios", "secret");

            GuardAppClients.CanUpdate(clients, command);
        }
Esempio n. 3
0
        public void UpdateClient_should_throw_exception_if_client_has_same_permission()
        {
            var command = new UpdateClient {
                Id = "ios", Permission = AppClientPermission.Editor
            };

            clients.Add("ios", "secret");

            Assert.Throws <ValidationException>(() => GuardAppClients.CanUpdate(clients, command));
        }
Esempio n. 4
0
        public void UpdateClient_should_throw_exception_if_client_has_same_name()
        {
            var command = new UpdateClient {
                Id = "ios", Name = "ios"
            };

            clients.Add("ios", "secret");

            Assert.Throws <ValidationException>(() => GuardAppClients.CanUpdate(clients, command));
        }
Esempio n. 5
0
        public void UpdateClient_should_throw_exception_if_client_has_invalid_permission()
        {
            var command = new UpdateClient {
                Id = "ios", Permission = (AppClientPermission)10
            };

            var clients_1 = clients_0.Add("ios", "secret");

            Assert.Throws <ValidationException>(() => GuardAppClients.CanUpdate(clients_1, command));
        }
Esempio n. 6
0
        public void CanUpdate_should_throw_execption_if_client_id_is_null()
        {
            var command = new UpdateClient();

            Assert.Throws <ValidationException>(() => GuardAppClients.CanUpdate(clients, command));
        }