moles

Microsoft Moles HostType errors in TFS 2010 Lab Management environment

半腔热情 提交于 2019-12-23 05:47:04
问题 I'm using TFS 2010 SP1 Lab Management and a variation on the LapDeployTemplate to execute build workflows and unit tests on a Hyper-V VM, managed via SCVMM (per the ALM Rangers Lab Management Guidance doco on codeplex). After configuring all of this, I've created a Test Plan containing test cases that map to automated unit/integration tests that use Moles. I've used tcm.exe import these test cases and get them into the Microsoft Test Manager. I'm getting the following error when I try to

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

how can I use Moles to redirect select from tables via LINQ?

最后都变了- 提交于 2019-12-22 10:49:57
问题 I have a table called Subscriptions. I'd like to redirect any LINQ select from that table to a Moles lambda so that only 3 rows are returned from that table -- basically I want to bypass the call to the database. So far, the code I have looks like this: // lazy loader is here to handle successive calls to the // same table (otherwise there's an error) // CM is a namespace alias Table<CM.Subscriptions> subsTable = null; MTheDataContext.AllInstances.SubscriptionsGet = (c) => { if (subsTable ==

Trying to use Moles with NUnit. Getting “Moles requires tests to be an instrumented process”

和自甴很熟 提交于 2019-12-21 05:16:09
问题 I am trying to use moles with NUnit and am getting the following error "Moles requires tests to be an instrumented process". I am also using Visual NUnit within Visual Studio 2008 to get this working. Any help is welcome. 回答1: This is what I did in order to make Moles work with NUnit: Grab the archive at C:\Program Files (x86)\Microsoft Moles\Documentation\moles.samples.zip and extract the Moles solution folder. Build the NUnit project in Visual Studio (2008) for Release. Copy the output

How To Read UnitTest Project's App.Config From Test With HostType(“Moles”)

百般思念 提交于 2019-12-21 03:46:25
问题 I have the folowing tests: [TestClass] public class GeneralTest { [TestMethod] public void VerifyAppDomainHasConfigurationSettings() { string value = ConfigurationManager.AppSettings["TestValue"]; Assert.IsFalse(String.IsNullOrEmpty(value), "No App.Config found."); } [TestMethod] [HostType("Moles")] public void VerifyAppDomainHasConfigurationSettingsMoles() { string value = ConfigurationManager.AppSettings["TestValue"]; Assert.IsFalse(String.IsNullOrEmpty(value), "No App.Config found."); } }

Moles and SharePoint Behaviour types

给你一囗甜甜゛ 提交于 2019-12-20 02:28:54
问题 We are having problems with the following code: BSPSite site = new BSPSite(); BSPWeb web = site.SetRootWeb(); The error is : Could not load file or assembly 'System.Moles, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0ae41878053f6703' or one of its dependencies. The system cannot find the file specified. We have tried rebuilding the Behavoir assembly in the source code to .NET 4 but that didn't go through. We are using v0.94. Any help would be appreciates. 回答1: 1) Go to C:\Program Files

Using Moles with DateTime

不羁的心 提交于 2019-12-19 03:31:48
问题 I'm starting to using Moles in unit tests and am struggling a little with documentation. I want to mole DateTime.Now. If you look around the old way of doing this was to add a reference to mscorlib, then add a stubx file for it (Add New Item -> Stubs And Moles For Testing). The 'Stubs and Moles for Testing' template has been deprecated, instead all you need do is to right click a reference and select 'Add moles assembly', whch is fine. VS2010 does not allow you to add a reference directly to

How to use mole manually in Visual Studio Express?

自作多情 提交于 2019-12-13 03:59:38
问题 I searched for tags "Moles" and "Visual Studio Express", and found no questions. That probably means I'm the only person trying to use Express with Moles :) In Express, there are no options such as "Add moles assembly", or "Add mscorlib". I've managed to get the tutorial for the DateTime Y2Kbug working after manually adding a couple of references that would normally be handled by VS. So, that means that I can mole any of the pre-moled stuff in System or mscorlib, which will be useful. My

unit testing legacy code: limits of “extract and override” vs JustMock/TypeMock/moles?

无人久伴 提交于 2019-12-12 15:04:38
问题 Given the following conditions: a very old, big, C# legacy code base with no testcoverage whatsoever (almost) every class derives from some interface nothing is sealed What are the practical benefits of using profiler-API-driven solutions like JustMock and TypeMock, compared to using extract&override + e.g. RhinoMocks? Are there cases I'm not aware of, besides circumventing private/protected, where using TypeMock/JustMock etc. is really needed ? I'd especially welcome some experience from

Stub generation failes with obsolete attribute, Pex v0.94.51023.0

强颜欢笑 提交于 2019-12-12 01:49:55
问题 I have an interface with a method marked with the obsolete attribute. The attributes error parameter is set to true to throw an exception when used. The problem is this causes the stub to not generate for the whole class. When I alter the value to false the stub generates as expected. I’m looking for a way to generate the stub while retaining the error parameter as true . public interface ICar { void Start(); [Obsolete("this is obsolete Stop, stop using it", true)] void Stop(); } I’ve tried