Note: This was written using elasticsearch 0.9.
Elasticsearch will automatically create an index (with basic settings and mappings) for you if you post a first document:
$ curl -X POST 'http://localhost:9200/thegame/weapons/1' -d \
'{
"_id": 1,
[TestMethod] | |
public void ShouldNotAccessDataAccessLayerDirectly() { | |
Type webRepresentative = typeof(HomeController); | |
Type dataAccessRepresentative = typeof(BaseRepository); | |
var references = webRepresentative.Assembly.GetReferencedAssemblies(); | |
AssemblyName webAssemblyName = webRepresentative.Assembly.GetName(); | |
AssemblyName unwantedReferenceAssemblyName = dataAccessRepresentative.Assembly.GetName(); | |
public class Option<T>: IEnumerable<T> | |
{ | |
private T[] data; | |
private Option(T[] data) | |
{ | |
this.data = data; | |
} | |
public static Option<T> Create(T element) |
public static class IEnumerableExtensions | |
{ | |
public static void ForEach<T>(this IEnumerable<T> source, Action<T> action) | |
{ | |
foreach (T obj in source) | |
action(obj); | |
} | |
public static IEnumerable<T> LazyDefaultIfEmpty<T>(this IEnumerable<T> source, | |
Func<T> defaultFactory) |
public struct NullableBool | |
{ | |
private readonly bool? value; | |
public NullableBool(bool? value) | |
{ | |
this.value = value; | |
} | |
public static implicit operator bool(NullableBool input) |
using System; | |
using System.IO; | |
using System.Net; | |
namespace Demo | |
{ | |
class Failed | |
{ | |
} |
public static class OptionExtensions | |
{ | |
public static async Task<Option<T>> AsOption<T>(this Task<T> item) => AsOption<T>(await item); | |
public static Option<T> AsOption<T>(this T item) => item == null ? Option.None<T>() : Option.Some<T>(item); | |
} | |
public abstract class Option<T> : IEquatable<Option<T>>, IEquatable<T> | |
{ | |
public abstract void Do(Action<T> action); |
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Data; | |
using System.Data.SqlClient; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.Runtime.CompilerServices; | |
using System.Threading.Tasks; | |
using Microsoft.Extensions.Logging; |
Note: This was written using elasticsearch 0.9.
Elasticsearch will automatically create an index (with basic settings and mappings) for you if you post a first document:
$ curl -X POST 'http://localhost:9200/thegame/weapons/1' -d \
'{
"_id": 1,
using System; | |
using System.Linq.Expressions; | |
using Moq.Language.Flow; | |
namespace Moq | |
{ | |
public static class MoqExtensions | |
{ | |
public static ISetup<T, TResult> SetupIgnoreArgs<T, TResult>(this Mock<T> mock, | |
Expression<Func<T, TResult>> expression) |
When using Autofixture I usually combine it with Automoq to automatically moq my dependencies in the SUT that I am excercising.
public class AutoMoqDataAttribute : AutoDataAttribute
{
public AutoMoqDataAttribute() : base(() => new Fixture().Customize(new AutoMoqCustomization()))
{
}
}
public class InlineAutoMoqDataAttribute : InlineAutoDataAttribute