Skip to content

Instantly share code, notes, and snippets.

@luizdamim
luizdamim / accounts_fixtures.ex
Last active May 21, 2019 17:36
Elixir manual fixtures
# tests/support/fixtures/accounts_fixtures.ex
defmodule Nononon.TestFixtures.AccountsFixtures do
alias Nononon.Repo
alias Nononon.Accounts.{
Group,
User,
Permission,
GroupUser,
GroupPermission
using System;
using CommonDomain.Core;
namespace commondomain
{
// This is my old buddy Account. It inherits from AggregateBase, which comes from CommonDomain.
// There's no real need to bring CommonDomain in if you don't want. It provides a couple simple mechanisms for me.
// First, it gives me the IRepository wrapper around EventStore which I use above in my CommandHandlers
// Second, it gives me a base that tracks all of my uncommitted changes for me.
// Third, it wires up, by convention, my event handlers (the private void Apply(SomeEvent @event) methods
using System.DirectoryServices;
using System.DirectoryServices.Protocols;
using System.Net;
bool ValidateUser(string username, string password)
{
bool authorized = false;
using(LdapConnection connection = new LdapConnection("192.168.0.5"))
{
@luizdamim
luizdamim / Customer.cs
Created June 5, 2013 00:04
NHibernate `ISessionFactory` for in-memory SQLite.
public class Customer
{
public virtual int Id { get; set; }
public virtual string FirstName { get; set; }
public virtual string LastName { get; set; }
}
@luizdamim
luizdamim / NHibernateConfig.cs
Created June 5, 2013 00:00
Basic `ISessionFactory` setup and class mapping using Loquacious Mappings for NHibernate.
using System.Reflection;
using NHibernate;
using NHibernate.Cfg;
using NHibernate.Cfg.MappingSchema;
using NHibernate.Mapping.ByCode;
namespace ManhattanProject
{
public class NHibernateConfig
{