Nil*_*ils 3 c# f# unit-testing naming
我在FsUnit中读到以下是F#中有效的方法/类名:
[<TestFixture>]
type ``Given a LightBulb that has had its state set to true`` ()=
let lightBulb = new LightBulb(true)
[<Test>] member test.
``when I ask whether it is On it answers true.`` ()=
lightBulb.On |> should be True
Run Code Online (Sandbox Code Playgroud)
有没有办法在c#中使用这样的方法或类名?
不,您不能在C#方法名称中包含空格或标点符号.你可以做:
[TestMethod]
public void When_Asked_Whether_It_Is_On_It_Answers_True() {}
Run Code Online (Sandbox Code Playgroud)