nunit-mocks

Where is the NUnit.Mocks documentation? [closed]

元气小坏坏 提交于 2019-12-23 06:57:42
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . Where is the documentation for NUnit's mocking library, NUnit.Mocks? I can't find anything in their official documentation or wiki. 回答1: As I have been told recently Nunit.Mocks are not meant to be used for serious applications. Given it's obvious limitations you're better off with a different framework anyway..

Has anyone successfully mocked the Socket class in .NET?

两盒软妹~` 提交于 2019-12-18 15:40:24
问题 I'm trying to mock out the System.net.Sockets.Socket class in C# - I tried using NUnit mocks but it can't mock concrete classes. I also tried using Rhino Mocks but it seemed to use a real version of the class because it threw a SocketException when Send(byte[]) was called. Has anyone successfully created and used a Socket mock using any mocking framework? 回答1: Whenever I run into these kinds of problems with Moq I end up creating an interface to abstract away the thing I can't mock. So in

How to invoke WPF Dispatcher in Nunit?

穿精又带淫゛_ 提交于 2019-12-07 03:33:59
问题 I want to test an application which renders a text block with a data field value. I would like to get the actual width and actual height, once the rendering completes. Everything works fine. The problem came first, when I tried to test the application. I'm unable to invoke the dispatcher from the test project. Following is the code. this.Loaded += (s, e) => { TextBlock textBlock1 = new TextBlock(); //// Text block value is assigned from data base field. textBlock1.Text =

How to invoke WPF Dispatcher in Nunit?

旧巷老猫 提交于 2019-12-05 06:36:38
I want to test an application which renders a text block with a data field value. I would like to get the actual width and actual height, once the rendering completes. Everything works fine. The problem came first, when I tried to test the application. I'm unable to invoke the dispatcher from the test project. Following is the code. this.Loaded += (s, e) => { TextBlock textBlock1 = new TextBlock(); //// Text block value is assigned from data base field. textBlock1.Text = strValueFromDataBaseField; //// Setting the wrap behavior. textBlock1.TextWrapping = TextWrapping.WrapWithOverflow; ////

Has anyone successfully mocked the Socket class in .NET?

和自甴很熟 提交于 2019-11-30 13:01:38
I'm trying to mock out the System.net.Sockets.Socket class in C# - I tried using NUnit mocks but it can't mock concrete classes. I also tried using Rhino Mocks but it seemed to use a real version of the class because it threw a SocketException when Send(byte[]) was called. Has anyone successfully created and used a Socket mock using any mocking framework? Whenever I run into these kinds of problems with Moq I end up creating an interface to abstract away the thing I can't mock. So in your instance you might have an ISocket interface that implements the Send method. Then have your mocking