Your first integration test
Writing your first integration test is deceivingly easy. You just call your code without caring about the external dependencies, as we do with unit testing.
We have some code that can get user information from the database by the UserName
parameter:
module DataAccess = open System open System.Data open System.Data.Linq open Microsoft.FSharp.Data.TypeProviders open Microsoft.FSharp.Linq type dbSchema = SqlDataConnection<"Data Source=.;Initial Catalog=Chapter05;Integrated Security=SSPI;"> let db = dbSchema.GetDataContext() // Enable the logging of database activity to the console. db.DataContext.Log <- System.Console.Out type User = { ID : int; UserName : string; Email : string } // get user by name let getUser name = query { for row in db.User do where (row.UserName = name) select { ID = row.ID; UserName = row.UserName; Email = row.Email } } |> Seq...