nunit

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..

NCover 1.5.8 with Moles/Pex and NUnit

给你一囗甜甜゛ 提交于 2019-12-23 05:19:33
问题 I'm having trouble getting the following to work together. NCover 1.5.8 (the version shipped with TestDriven.NET) NUnit 2.5 (the version shipped with TestDriven.NET) Moles and Pex I'm using Windows 7 x64 with a .NET 4.0 Pex and Moles test library I have tried to follow tips from this similar question (about getting Moles to work with MSTest) and related links. I did manage to get Moles and NUnit to work together thanks to this answer, but I cannot get it to work with NCover. Here's a batch

I am getting System.BadImageFormatException : The operating system cannot run exception while running unit tests

醉酒当歌 提交于 2019-12-23 03:58:05
问题 I am working on a Winforms project. Currently I am facing a problem that running some of the test cases throw System.BadImageFormatException : The operating system cannot run . (Exception from HRESULT: 0x800700B6) exception. This happens only if I run tests through NUnit. However, if I run the application through the code, it works fine. Remoting is being used in the application. Can that be an issue? 回答1: Make sure both NUNIT and your code are compiled to the same platform - x86 or x64. The

used in multiple [TestFixture]s

 ̄綄美尐妖づ 提交于 2019-12-23 03:19:05
问题 I'm in the process of setting up tests in NUnit and have a newbie question. Is it possible to have a Test/s that could be used in multiple [TestFixture]s? So [Test]ValidateString(string bob) Could be called in a series of different [TestFixture]? 回答1: That doesn't sound like a test to me. Tests are typically parameterless (unless you're using [TestCase] s) and running it within a context of a single fixture would typically be enough -- it either passes once and that's good or it doesn't and

Help with this unit test using Moq

你说的曾经没有我的故事 提交于 2019-12-23 03:16:25
问题 I have the following so far which I am trying to unit test: private Mock<IDBFactory> _mockDbFactory; private IArticleManager _articleManager; [Setup] public Setup() { _mockDbFactory = new Mock<IDBFactory>(); _articleManager = new ArticleManager(_mockDbFactory); } [Test] public void load_article_by_title() { string title = "sometitle"; // _dbFactory.GetArticleDao().GetByTitle(title); <!-- need to mock this _mockDBFactory.Setup(x => x.GetArticleDao().GetByTitle(It.IsAny<string>()));

Help with this unit test using Moq

旧时模样 提交于 2019-12-23 03:16:01
问题 I have the following so far which I am trying to unit test: private Mock<IDBFactory> _mockDbFactory; private IArticleManager _articleManager; [Setup] public Setup() { _mockDbFactory = new Mock<IDBFactory>(); _articleManager = new ArticleManager(_mockDbFactory); } [Test] public void load_article_by_title() { string title = "sometitle"; // _dbFactory.GetArticleDao().GetByTitle(title); <!-- need to mock this _mockDBFactory.Setup(x => x.GetArticleDao().GetByTitle(It.IsAny<string>()));

How do I run my NUnit test cases using Selenium to run against different environments?

旧时模样 提交于 2019-12-23 03:10:04
问题 I have written NUnit test cases using Selenium to test a web application. And I would like to run the same test cases against different environments (e.g. QA, Staging, & Production) What's the easiest way to achieve that? 回答1: NUnit supports parametrised test fixtures as well as parametrised tests. So the first thing is that are you going to want to run specific tests against different environments, or is it the entire test fixture will be rerun for both environments? I ask because the answer

Xamarin - Cross Platform Unit Testing

余生颓废 提交于 2019-12-22 13:55:20
问题 I am putting together my teams development environment gearing up for our first big Xamarin.Forms project, involving a whole team from an Agile perspective. I need to verify one assumption before I move forward... Unit Testing. We plan on implementing a build infrastructure using TFS for Android and Windows Phone with Jenkins on OSX. Are there any special considerations we need to make when we create Unit Test projects? Using NUnit Can I just create class libraries that contain tests? Do they

Handling Multiple Mocks and Asserts in Unit Tests

烂漫一生 提交于 2019-12-22 12:43:26
问题 I currently have a repository that is using Entity Framework for my CRUD operations. This is injected into my service that needs to use this repo. Using AutoMapper, I project the entity Model onto a Poco model and the poco gets returned by the service. If my objects have multiple properties, what is a correct way to set-up and then assert my properties? If my service has multiple repo dependencies what is the correct way to setup all my mocks? * - A class [setup] where all the mocks and

How to pass string and dictionary in NUnit test cases?

时光毁灭记忆、已成空白 提交于 2019-12-22 10:19:02
问题 I want to make test for my method and I can pass 2 string variables, but I don't know how to pass the Dictionary<,> . It looks like this: [Test] [TestCase("agr1", "askdwskdls", Dictionary<TypeMeasurement,double>)] public void SendDataToAgregator_GoodVariables_ReturnsOn(string agrID,string devID, Dictionary<TypeMeasurement, double> measurement) { } TypeMeasurement is enum and I know that this is not how you pass dictionary, but I don't know how, so I place it there so that you know what I want