Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace TesteApp
- {
- /// <summary>
- /// Classe de testes
- /// </summary>
- public static class Teste
- {
- public static bool PodeAtualizar(Usuario user)
- {
- return (user.Operacoes & Operacoes.Atualizar) != 0;
- }
- public static bool PodeLer(Usuario user)
- {
- return (user.Operacoes & Operacoes.Ler) != 0;
- }
- public static bool PodeEscrever(Usuario user)
- {
- return (user.Operacoes & Operacoes.Escrever) != 0;
- }
- public static bool PodeDeletar(Usuario user)
- {
- return (user.Operacoes & Operacoes.Deletar) != 0;
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- var funcionario = new Funcionario();
- Console.WriteLine(Teste.PodeAtualizar(funcionario)); // imprime verdadeiro
- Console.WriteLine(Teste.PodeDeletar(funcionario)); // imprime falso, funcionário não tem o poder de deletar!
- Console.WriteLine(Teste.PodeLer(funcionario)); // imprime verdadeiro
- Console.WriteLine(Teste.PodeEscrever(funcionario)); // imprime verdadeiro
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement