【发布时间】:2018-11-07 14:30:06
【问题描述】:
我想将 nunit 的 teardownattribute 与 System.IDisposable 的实现结合使用,因为我想在 F# 中使用 use 关键字。为什么我在运行测试时会收到此错误?
[<TestFixture>]
type public when_it_connects_to_database() =
interface IDisposable with
[<TearDown>]
member this.Dispose() =
this.connection.Dispose()
member val public connection : ApplicationDbContext = createdatabasegateway true
with get, set
[<TestCase(true)>]
member public this.it_succeeds(testmode:bool) : ApplicationDbContext =
this.connection <- createdatabasegateway testmode
this.connection
[<Test>]
member public this.it_can_read_the_database() =
this.connection.AvailableExchanges.AsEnumerable().Count()
测试名称:it_can_read_the_database 测试 全名:tests.when_it_connects_to_database.it_can_read_the_database 测试 :第 29 行测试结果:失败测试持续时间:0:00:00.0000001
结果消息:OneTimeSetUp:SetUp 或 TearDown 的签名无效 方法:System-IDisposable-Dispose
【问题讨论】: