{"action":"closed","issue":{"url":"https://api.github.com/repos/mausch/Fuchu/issues/57","repository_url":"https://api.github.com/repos/mausch/Fuchu","labels_url":"https://api.github.com/repos/mausch/Fuchu/issues/57/labels{/name}","comments_url":"https://api.github.com/repos/mausch/Fuchu/issues/57/comments","events_url":"https://api.github.com/repos/mausch/Fuchu/issues/57/events","html_url":"https://github.com/mausch/Fuchu/issues/57","id":174890531,"number":57,"title":"How to use the initializer only once for multiple tests?","user":{"login":"mrakgr","id":6266635,"avatar_url":"https://avatars.githubusercontent.com/u/6266635?v=3","gravatar_id":"","url":"https://api.github.com/users/mrakgr","html_url":"https://github.com/mrakgr","followers_url":"https://api.github.com/users/mrakgr/followers","following_url":"https://api.github.com/users/mrakgr/following{/other_user}","gists_url":"https://api.github.com/users/mrakgr/gists{/gist_id}","starred_url":"https://api.github.com/users/mrakgr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrakgr/subscriptions","organizations_url":"https://api.github.com/users/mrakgr/orgs","repos_url":"https://api.github.com/users/mrakgr/repos","events_url":"https://api.github.com/users/mrakgr/events{/privacy}","received_events_url":"https://api.github.com/users/mrakgr/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-09-03T10:31:01Z","updated_at":"2016-09-04T06:58:03Z","closed_at":"2016-09-04T06:58:03Z","body":"```\r\nopen Fuchu\r\n\r\nlet clo f () = \r\n    printfn \"Initializing...\"\r\n    let mem = 2 // Allocate some unmanaged resources (like GPU memory for example.)\r\n    f mem\r\n    printfn \"Freeing...\"\r\n\r\n/// Applies a function to a value\r\nlet inline testFixture' setup (name, partialTest) = \r\n    testCase name (setup partialTest)\r\n\r\nlet test1 x = printfn \"Doing something with that memory...\"\r\nlet test2 x = printfn \"Doing something else with that memory...\" \r\nlet test3 x = printfn \"Third test that uses the memory...\"\r\nlet testCombined x = test1 x; test2 x; test3 x // How do I get this to count as 3 tests instead of 1?\r\nlet tests = testFixture' clo (\"3 tests\",testCombined)\r\nrun tests\r\n```\r\nAlternatively, just using `testFixture`, is it possible to use the setup only once, pass the resulting parameters to the tests and dispose of it afterwards? To be honest this is quite a puzzler, and I have no idea how to deal with this. In XUnit or NUnit (assuming there weren't bugs making the adapter unable to find the tests) I would just use a fixture class. \r\n\r\nWith the [example](http://bugsquash.blogspot.hr/2012/05/f-dsl-for-mbunit.html) I found on the blog, the setup would have to be triggered each time for every test. I think there should be a middle ground between loading the thing every time and loading it only once outside of the test suite.\r\n\r\nAny idea how?"}}
{"actor":{"display_login":"mrakgr"}}