public void CanRevoke_should_throw_execption_if_client_id_is_null() { var command = new RevokeClient(); ValidationAssert.Throws(() => GuardAppClients.CanRevoke(clients_0, command), new ValidationError("Client id is required.", "Id")); }
public void CanAttach_should_throw_execption_if_client_id_is_null() { var command = new AttachClient(); ValidationAssert.Throws(() => GuardAppClients.CanAttach(command, App(clients_0)), new ValidationError("Client ID is required.", "Id")); }
public void CanRevoke_should_throw_exception_if_client_is_not_found() { var command = new RevokeClient { Id = "ios" }; Assert.Throws <DomainObjectNotFoundException>(() => GuardAppClients.CanRevoke(clients_0, command)); }
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_0, command, Roles.Empty)); }
public void CanUpdate_should_throw_execption_if_client_id_is_null() { var command = new UpdateClient { Name = "iOS" }; ValidationAssert.Throws(() => GuardAppClients.CanUpdate(clients_0, command, Roles.Empty), new ValidationError("Client id is required.", "Id")); }
public void CanAttach_should_not_throw_exception_if_client_is_free() { var command = new AttachClient { Id = "ios" }; var clients_1 = clients_0.Add("android", "secret"); GuardAppClients.CanAttach(clients_1, command); }
public void CanRevoke_should_not_throw_exception_if_client_is_found() { var command = new RevokeClient { Id = "ios" }; var clients_1 = clients_0.Add("ios", "secret"); GuardAppClients.CanRevoke(clients_1, command); }
public void UpdateClient_should_throw_exception_if_client_has_same_permission() { var command = new UpdateClient { Id = "ios", Permission = AppClientPermission.Editor }; var clients_1 = clients_0.Add("ios", "secret"); Assert.Throws <ValidationException>(() => GuardAppClients.CanUpdate(clients_1, command)); }
public void UpdateClient_should_not_throw_exception_if_command_is_valid() { var command = new UpdateClient { Id = "ios", Name = "iOS", Role = Role.Reader }; var clients_1 = clients_0.Add("ios", "secret"); GuardAppClients.CanUpdate(clients_1, command, roles); }
public void CanAttach_should_throw_exception_if_client_already_exists() { var command = new AttachClient { Id = "android" }; var clients_1 = clients_0.Add("android", "secret"); Assert.Throws <ValidationException>(() => GuardAppClients.CanAttach(clients_1, command)); }
public void UpdateClient_not_should_throw_exception_if_client_has_same_role() { var command = new UpdateClient { Id = "ios", Role = Role.Editor }; var clients_1 = clients_0.Add("ios", "secret"); GuardAppClients.CanUpdate(clients_1, command, roles); }
public void UpdateClient_should_not_throw_exception_if_client_has_same_name() { var command = new UpdateClient { Id = "ios", Name = "ios" }; var clients_1 = clients_0.Add("ios", "secret"); GuardAppClients.CanUpdate(command, App(clients_1)); }
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"); ValidationAssert.Throws(() => GuardAppClients.CanUpdate(clients_1, command), new ValidationError("Permission is not valid.", "Permission")); }
public void UpdateClient_should_throw_exception_if_client_has_same_permission() { var command = new UpdateClient { Id = "ios", Permission = AppClientPermission.Editor }; var clients_1 = clients_0.Add("ios", "secret"); ValidationAssert.Throws(() => GuardAppClients.CanUpdate(clients_1, command), new ValidationError("Client has already this permission.", "Permission")); }
public void CanAttach_should_throw_exception_if_client_already_exists() { var command = new AttachClient { Id = "android" }; var clients_1 = clients_0.Add("android", "secret"); ValidationAssert.Throws(() => GuardAppClients.CanAttach(clients_1, command), new ValidationError("A client with the same id already exists.")); }
public void UpdateClient_should_throw_exception_if_client_has_invalid_role() { var command = new UpdateClient { Id = "ios", Role = "Invalid" }; var clients_1 = clients_0.Add("ios", "secret"); ValidationAssert.Throws(() => GuardAppClients.CanUpdate(clients_1, command, roles), new ValidationError("Role is not a valid value.", "Role")); }
public void UpdateClient_should_throw_exception_if_client_has_no_name_and_role() { var command = new UpdateClient { Id = "ios" }; var clients_1 = clients_0.Add("ios", "secret"); ValidationAssert.Throws(() => GuardAppClients.CanUpdate(clients_1, command, roles), new ValidationError("Either name or role must be defined.", "Name", "Role")); }
public void UpdateClient_should_throw_exception_if_client_has_same_name() { var command = new UpdateClient { Id = "ios", Name = "ios" }; var clients_1 = clients_0.Add("ios", "secret"); ValidationAssert.Throws(() => GuardAppClients.CanUpdate(clients_1, command), new ValidationError("Client has already this name.", "Name")); }
public void UpdateClient_should_throw_exception_if_api_traffic_limit_is_less_than_zero() { var command = new UpdateClient { Id = "ios", ApiTrafficLimit = -10 }; var clients_1 = clients_0.Add("ios", "secret"); ValidationAssert.Throws(() => GuardAppClients.CanUpdate(command, App(clients_1)), new ValidationError("ApiTrafficLimit must be greater or equal to 0.", "ApiTrafficLimit")); }
public void UpdateClient_should_throw_exception_if_client_has_same_role() { var command = new UpdateClient { Id = "ios", Role = Role.Editor }; var clients_1 = clients_0.Add("ios", "secret"); ValidationAssert.Throws(() => GuardAppClients.CanUpdate(clients_1, command, roles), new ValidationError("Client has already this role.", "Role")); }
public void CanUpdate_should_throw_execption_if_client_id_is_null() { var command = new UpdateClient(); Assert.Throws <ValidationException>(() => GuardAppClients.CanUpdate(clients_0, command)); }