Skip to content

Instantly share code, notes, and snippets.

[Fact]
public void AssertNestedInnerException()
{
var expectedException = new Exception();
new Action(
() =>
{
throw new InvalidOperationException("", new KeyNotFoundException("", expectedExcpetion));
})
private void ConfigureLogging()
{
this.log = this.loggerConfiguration.CreateLogger().ForContext<DefaultBootstrapper>();
LogManager.GetLog = type => new CaliburnSerilogAdapter(this.log.ForContext(type));
LogContext.PushProperty("a", 1);
this.log.Information("template", this, null, new Uri("http://google.de"));
this.log.ForContext(typeof(string)).Information("template2", this, null, new Uri("http://bing.com"));
}
public void Configure(IAppBuilder appBuilder)
{
this.container.RegisterSingle<ITodoRepository>(() => new TodoDatabase(this.slowness, this.todoCount));
var httpConfig = new HttpConfiguration();
httpConfig.Routes.MapHttpRoute(
"DefaultApi",
"{controller}/{id}",
new { id = RouteParameter.Optional });
httpConfig.DependencyResolver = new SimpleInjectorDependencyResolver(this.container);
@bitbonk
bitbonk / Model
Created May 8, 2015 20:16
ACL (Access Control List) in DDD (with CQS)
namespace UserManagement.Model
{
namespace Query
{
using System;
using System.Collections.Generic;
public class User
{
/// <summary>
@bitbonk
bitbonk / TinyBootstrapper.cs
Last active August 29, 2015 14:19
Minimal Calibrun.Micro Bootstrapper Implementation that uses TinyIoC
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Windows;
using Caliburn.Micro;
using TinyIoC;
public class TinyBootstrapper : BootstrapperBase
{
@bitbonk
bitbonk / Program.cs
Last active August 29, 2015 14:18
Debugging dynmically created scriptcs source code string in a hosted environment
namespace DebugStringConsoleHosted
{
using System.IO;
using System.Linq;
using Common.Logging.Simple;
using ScriptCs.Contracts;
using ScriptCs.Engine.Roslyn;
using ScriptCs.Hosting;
internal class Program
@bitbonk
bitbonk / Program.cs
Last active September 29, 2017 21:13
Host ScriptCs in a console application and install a script pack at startup
namespace ConsoleHostedScriptCs
{
using System;
using Common.Logging.Simple;
using NuGet;
using ScriptCs.Contracts;
using ScriptCs.Engine.Roslyn;
using ScriptCs.Hosting;
using PackageReference = ScriptCs.PackageReference;