Skip to content

Instantly share code, notes, and snippets.

@srdjan
Created December 15, 2012 17:11
Show Gist options
  • Select an option

  • Save srdjan/4297273 to your computer and use it in GitHub Desktop.

Select an option

Save srdjan/4297273 to your computer and use it in GitHub Desktop.
using Simple.Data from F# for fun and...
open Simple.Data
open Xunit
open Swensen.Unquote
open ImpromptuInterface.FSharp
[<Fact>]
let ``Simple.Data data provider test`` () =
Database.UseMockAdapter(new InMemoryAdapter())
let db = Database.Open()
db?Test?Insert(dynArg(1) ? Id, dynArg("Alice") ? Name)
let record = db?Test?FindById(1)
test <@ record?Id = 1 @>
test <@ record?Name = "Alice" @>
//although...
//more native (and syntactically nicer) support for dynamics in #fsharp would help, too... ;)
//
[<Fact>]
let ``Simple.Data data provider test`` () =
Database.UseMockAdapter(new InMemoryAdapter())
let db = Database.Open()
db.Test.Insert(Id <- 1, Name <- "Alice")
let record = db.Test.FindById(1)
test <@ record.Id = 1 @>
test <@ record.Name = "Alice" @>
@srdjan
Copy link
Author

srdjan commented Dec 15, 2012

just a spike - Simple.Data is lovely and much more powerful than this simple test shows...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment