This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.Linq; | |
namespace SchoolOO.DAO | |
{ | |
public class GrupoDePessoas | |
{ | |
public IList<Person> PorOrdemAlfabetica() | |
{ | |
using (SchoolEntities schoolContext = new SchoolEntities()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestMethod] | |
public void Se_Eu_Criar_Uma_Pessoa_Com_Endereco_Nos_EUA_TemResidenciaNoExterior_Deve_Ser_Verdadeiro() | |
{ | |
Endereco[] enderecos = new [] { new Endereco("Porto Alegre", "BR"), new Endereco("Raccoon City", "US") }; | |
Pessoa johnDoe = new Pessoa("John Doe", enderecos); | |
// | |
Assert.IsTrue(johnDoe.TemResidenciaNoExterior()); | |
} | |
////////// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestMethod] | |
public void Se_Eu_Criar_Uma_Pessoa_Com_Endereco_Nos_EUA_TemResidenciaNoExterior_Deve_Ser_Verdadeiro() | |
{ | |
Pessoa johnDoe = new Pessoa("John Doe"); | |
// Como injetar os endereços para testar Pessoa isoladamente? | |
Assert.IsTrue(johnDoe.TemResidenciaNoExterior()); | |
} | |
////////// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Linq; | |
using System.Xml.Linq; | |
namespace Foo.Namespace | |
{ | |
public class XmlUtils | |
{ | |
public static string RemoveAllNamespaces(string xmlDocument) | |
{ | |
XElement xmlDocumentWithoutNs = RemoveAllNamespaces(XElement.Parse(xmlDocument)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Web.Mvc; | |
namespace Teste.TrocandoDadosComActionFilter.Controllers | |
{ | |
public class HomeController : Controller | |
{ | |
[MudaCor] | |
public ActionResult Index() | |
{ | |
ViewBag.Cor = "Welcome to ASP.NET MVC!"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Pessoa | |
{ | |
public virtual int Id { get; private set; } | |
public virtual string Nome { get; set; } | |
public virtual string Email { get; set; } | |
} | |
public class Login : Pessoa | |
{ | |
public virtual string Senha { get; set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PessoaMap : ClassMap<Pessoa> | |
{ | |
public PessoaMap() | |
{ | |
Id(x => x.Id); | |
Map(x => x.Nome); | |
Map(x => x.Email); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.Linq; | |
using System.Windows.Forms; | |
namespace WindowsFormsApplication1 | |
{ | |
public partial class Form1 : Form | |
{ | |
public Form1() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Diagnostics; | |
namespace MicroBenchmark.Hashtable | |
{ | |
class Program | |
{ | |
const int HASH_SIZE = 1000000; | |
static Guid keyToRetrieve; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sessionFactory = Fluently | |
.Configure() | |
.Database(MsSqlConfiguration.MsSql2008.ConnectionString(c => c.FromConnectionStringWithKey("MyConnString"))) | |
.Mappings(x => x.AutoMappings.Add(AutoMap.AssemblyOf<MyEntity>(mapConfig) | |
.OverrideAll(ign => ign.IgnoreProperty("MyPropertyToBeIgnored")) | |
)) | |
.ExposeConfiguration(cfg => new SchemaUpdate(cfg).Execute(false, true)) | |
.BuildSessionFactory(); | |
return sessionFactory; |
OlderNewer