开发者

Testing the existence of single instance -Singleton-C#

How to write test in Nunit to test that only one instance is creat开发者_运维问答ed by my singleton class.


var first = MySingleton.Instance;
var second = MySingleton.Instance;
Assert.AreSame(first, second);


Create the object twice and use Assert to make sure they have the same reference

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜