Skip to content

Instantly share code, notes, and snippets.

Estamos com uma vaga para desenvolvedor C# pleno, exigimos
* Experiência em desenvolvimento de Software
* Inglês intermediário
* Forte conhecimento em OO (http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod) e design patterns.
No nosso dia, nós trabalhamos com:
* C# 3 e 4
* Visual Studio 2008/2010
* ASP.NET MVC 2
* ASP.NET
using System.Web.Mvc;
using SharpArch.Data.NHibernate;
using System;
using NHibernate;
namespace SharpArch.Web.NHibernate
{
public class TransactionAttribute : ActionFilterAttribute
{
/// <summary>
public void DeveDar5PorcentoDeDescontoAVista(){
var produto = new Mock<Produto>();
produto.Setup(p => p.Preco).Return(10m);
var itemDaCompra = new ItemDaCompra(produto.Object);
// Verificação interna, desnecessária que cria um acoplamento maior que o necessário
produto.Verify(p => p.CalculeDescontoAVista(), Times.Once());
AssertAreEqual(9.5m, itemDaCompra.ValorTotalItem);
}
@rmueller
rmueller / exemplo.cs
Created April 25, 2012 22:35
usando inner classes para definir cenários nos testes
using NSubstitute;
using NUnit.Framework;
namespace ERP.Entrada.BaixaPedidoTestes
{
public class FechamentoCarrinhoDeCompraTeste
{
private CarrinhoDeCompras carrinhoCompras;
private Cliente cliente;
private List itensCarrinho;
@rmueller
rmueller / results
Last active September 9, 2015 17:36
| controller | requests | server sleep | avg response time | % responses in 30 seconds |
|------------|----------|--------------|-----------------------|---------------------------|
| async | 500 | 3 | 9 | 100 |
| async | 1000 | 3 | 20 | 100 |
| async | 500 | 6 | 22 | 100 |
| async | 1000 | 6 | 26 | 19 |
| async | 500 | 10 | 28 | 13,2 |
| async | 1000 | 10 | 29 | 3,5 |
| sync | 500 | 3 | 6 | 100 |
| sync | 1000 | 3 | 12 | 100 |
class Program
{
private static HttpSelfHostServer server;
public static int Timeout = 3000;
static void Main(string[] args)
{
if (args.Length > 0)
Timeout = Int32.Parse(args[0]) * 1000;
Console.WriteLine(System.Runtime.InteropServices.RuntimeEnvironment.SystemConfigurationFile);
System.Net.ServicePointManager.DefaultConnectionLimit = Int32.MaxValue;
class Program
{
static void Main(string[] args)
{
System.Net.ServicePointManager.DefaultConnectionLimit = Int32.MaxValue;
string baseAddress = "http://localhost:3333/";
// Start OWIN host
using (WebApp.Start<Startup>(url: baseAddress))
public class WebApiClient
{
private HttpWebRequest httpWebRequest;
public WebApiClient(Uri uri, int timeOut)
{
httpWebRequest = CreateHttpWebRequest(uri, timeOut);
}
public string Post(string conteudo)
@rmueller
rmueller / statsd_graphite_ubuntu14.sh
Last active November 2, 2015 20:53 — forked from rposbo/statsd_graphite_ubuntu14.sh
A single script to setup StatsD and Graphite on Ubuntu 15.10 on Azure
#!/bin/bash
# First I usually add a new disk and mount it on /opt, to make sure I dont run out of space on / on azure ubuntu linux
# https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-linux-how-to-attach-disk/
echo "#### Starting"
echo "#### apt-get updating and installing"
sudo apt-get update
sudo apt-get install screen libexpat1-dev libicu-dev git build-essential curl software-properties-common python-software-properties -y
Disable-UAC
choco feature enable -n=allowGlobalConfirmation
cinst 7zip.install
cinst ConEmu
cinst slack
cinst sublimetext3
cinst beyondcompare
cinst putty
cinst sysinternals