Skip to content

Instantly share code, notes, and snippets.

Nikos Baxevanis moodmosaic

Block or report user

Report or block moodmosaic

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@moodmosaic
moodmosaic / Scenarios.fs
Last active Aug 29, 2015
mountebank mocks with F#
View Scenarios.fs
module Mountebank.Scenarios
// PM> Install-Package xunit
// PM> Install-Package Unquote
open System
open System.Net.Mail
open Xunit
let verify = Swensen.Unquote.Assertions.test
@moodmosaic
moodmosaic / runner.html
Last active Aug 29, 2015
A small sample of a Jasmine custom matcher that internally parses expressions into an AST.
View runner.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Custom matchers for Expressions</title>
<!-- $ bower install jasmine && npm install jsep -->
<link href="bower_components/jasmine/lib/jasmine-core/jasmine.css" rel="stylesheet" />
<script src="bower_components/jasmine/lib/jasmine-core/jasmine.js"></script>
@moodmosaic
moodmosaic / Scenarios.fs
Last active Aug 29, 2015
mountebank stubs with F#
View Scenarios.fs
open FSharp.Data
open System
open System.Net
open Xunit
let verify = Swensen.Unquote.Assertions.test
[<Fact>]
[<UseImposterStub(
"192.168.1.4",
View Scenarios.fs
module Scenarios
open Ploeh.AutoFixture
open Ploeh.AutoFixture.Kernel
open Ploeh.Albedo
open Ploeh.Albedo.Refraction
open System
type TextEndsWithConvention(value, found) =
inherit ReflectionVisitor<bool>()
@moodmosaic
moodmosaic / TestDsl.fs
Last active Aug 29, 2015
F# port of @ploeh's answer at http://stackoverflow.com/a/20723447/467754 for ASP.NET Web API 2.
View TestDsl.fs
// F# port of @ploeh's answer at http://stackoverflow.com/a/20723447/467754 for ASP.NET Web API 2.
type WebApiCustomization() =
interface ICustomization with
member this.Customize fixture =
fixture.Customize<HttpConfiguration>(fun c ->
c.OmitAutoProperties() :> ISpecimenBuilder)
fixture.Customize<HttpRequestMessage>(fun c ->
c.Do(fun (x : HttpRequestMessage) ->
x.Properties.[HttpPropertyKeys.HttpConfigurationKey] <-
View Tests.cs
public interface IInterface
{
object MakeIt(object obj);
}
public abstract class AbstractTypeWithNonDefaultConstructor<T>
{
private readonly T property;
protected AbstractTypeWithNonDefaultConstructor(T value)
@moodmosaic
moodmosaic / 1-DomainModel.fs.diff
Last active Aug 29, 2015
In-memory Drain abstractions applied to A Functional Architecture with F#.
View 1-DomainModel.fs.diff
diff --git a/BookingApi/DomainModel.fs b/BookingApi/DomainModel.fs
index 4a4260f..c2079cf 100644
--- a/BookingApi/DomainModel.fs
+++ b/BookingApi/DomainModel.fs
@@ -7,6 +7,23 @@ type Period =
| Month of int * int
| Day of int * int * int
+[<AutoOpen>]
+module Drain =
@moodmosaic
moodmosaic / ReturnValueMustNotBeNullAssertionScenarios.fs
Created Nov 5, 2014
ReturnValueMustNotBeNullAssertionScenarios
View ReturnValueMustNotBeNullAssertionScenarios.fs
namespace ReturnValueMustNotBeNullAssertionScenarios
open FsCheck
open Ploeh.AutoFixture.Idioms.FsCheck
open Ploeh.AutoFixture.Kernel
open Ploeh.AutoFixture.Xunit
open System
open Xunit.Extensions
type Generators =
@moodmosaic
moodmosaic / DiamondProperties.fs
Created Feb 24, 2015
Exude applied to post titled: Property Based Testing without a Property Based Testing framework
View DiamondProperties.fs
let verify = Swensen.Unquote.Assertions.test
[<FirstClassTests>]
let ``Diamond is as wide as it's high`` () =
seq {'A' .. 'Z'}
|> Seq.map (fun letter -> TestCase (fun () ->
let actual = Diamond.make letter
let rows = split actual
let expected = rows.Length
@moodmosaic
moodmosaic / gist:7fba17beae7cee92581a
Last active Aug 29, 2015
Feedback, related to an answer on Stack Overflow at: http://stackoverflow.com/a/28798955/467754
View gist:7fba17beae7cee92581a
type OddlySpelledWords =
static member String() =
["zZ"; "oO0Ò"; "eEê"]
|> List.map Gen.elements
|> Gen.sequence
|> Gen.map (List.map string >> List.reduce (+))
|> Arb.fromGen
[<Property(Arbitrary = [| typeof<OddlySpelledWords> |])>]
let ``Generate oddly spelled words`` s =
You can’t perform that action at this time.