Skip to content

Instantly share code, notes, and snippets.

View ThiagoBarradas's full-sized avatar
👽
em marte!

Thiago Barradas ThiagoBarradas

👽
em marte!
View GitHub Profile
@ThiagoBarradas
ThiagoBarradas / xunit-theory-memberdata.cs
Last active August 10, 2024 08:47
xUnit Theory MemberData Sample
// models for example
public class SendEmailModel
{
public string Content { get; set; }
public string Email { get; set; }
}
public class SendEmailResult
@ThiagoBarradas
ThiagoBarradas / xunit-theory-classdata.cs
Last active January 25, 2021 16:07
xUnit Theory ClassData Sample
// class with parameters
public class SendEmailParameters : IEnumerable<object[]>
{
public IEnumerator<object[]> GetEnumerator()
{
// parameters to test send email success
yield return new object[]
{
new SendEmailModel
@ThiagoBarradas
ThiagoBarradas / xunit-theory-hybrid.cs
Last active January 25, 2021 16:08
xUnit Theory Hybrid (MemberData + ClassData) Sample
// test parameters
public class SendEmailParameters()
{
public static IEnumerable<object[]> Parameters()
{
// parameters to test send email success
yield return new object[]
{
new SendEmailModel
@ThiagoBarradas
ThiagoBarradas / azure-devops-sonarqube-job
Created June 27, 2019 01:49
azure-devops-sonarqube-job
- job: qa_analysis
dependsOn: unit_tests
steps:
- task: DownloadPipelineArtifact@2
inputs:
artifact: UnitTestResults
- script: |
pwd && ls -la
ls -la $(project_name).Tests
ls -la $(Pipeline.Workspace)
requests==2.8.1
future==0.18.2
from __future__ import print_function
import requests
import sys
import time
import os
def main():
trigger_url = sys.argv[1]
access_token = sys.argv[2]
@ThiagoBarradas
ThiagoBarradas / PRIVACY.md
Last active July 5, 2019 00:50
PRIVACY.md

Privacy Policy

Effective date: July 05, 2019

ThiagoBarradas Projects ("us", "we", or "our") operates the https://github.com/ThiagoBarradas website (the "Service").

This page informs you of our policies regarding the collection, use, and disclosure of personal data when you use our Service and the choices you have associated with that data. Our Privacy Policy for ThiagoBarradas Projects is created with the help of the Free Privacy Policy Generator.

We use your data to provide and improve the Service. By using the Service, you agree to the collection and use of information in accordance with this policy. Unless otherwise defined in this Privacy Policy, terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, accessible from https://github.com/ThiagoBarradas

public enum CorSemFlags // enumerador comum
{
Vermelho = 1,
Verde = 2,
Azul = 4,
Amarelo = 8
}
[Flags]
public enum Cor // usando flags, basta adicionar o atributo
// declaração errada com valores padrões
[Flags]
public enum Cor
{
Vermelho, // valor padrão 0
Verde, // valor padrão 1
Azul, // valor padrão 2
Amarelo // valor padrão 3
}
var cores = Cor.Verde | Cor.Vermelho;
var resultado1 = cores.HasFlag(Cor.Verde); // true
var resultado2 = cores.HasFlag(Cor.Vermelho); // true
var resultado3 = cores.HasFlag(Cor.Amarelo); // false
var resultado4 = cores.HasFlag(Cor.Verde | Cor.Vermelho); // true, pois contém os dois