chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes
I have set up a test with TypeMocks that runs perfectly fine when executed from the TestViewer by itself.

If the same test run is attempted among the list of all tests within the test project, it causes VSTestHost.exe to fail.

Any advice?
asked by csustek (4k points)

5 Answers

0 votes
Hi
1. How do you run your tests?
2. Can you post the task for TypeMock?
answered by ohad (35.4k points)
0 votes
1. Via Visual Studio, if this is what you mean.
2. Yes; here it is below:
/// <summary>
///A test for GetConfigurationGroupsByComponentId (int)
///</summary>
[TestMethod()]
public void GetConfigurationGroupsByComponentIdTest()
{
//ConfigurationGroupsByComponentIdManager target = new ConfigurationGroupsByComponentIdManager();
List<ConfigurationGroup> mockListConfigGroup = BuildConfigurationGroup();
List<ConfigurationGroup> mockListConfigGroupChildren = BuildConfigurationGroupChildren();
List<Configuration> mockListConfigs = BuildConfigurationList();

int componentId = 1;

List<ConfigurationGroup> expected = mockListConfigGroup;
List<ConfigurationGroup> actual;

Mock factoryMockGroups = MockManager.Mock(typeof(ConfigurationGroupRepository));
factoryMockGroups.ExpectAndReturn("FindConfigurationGroups", mockListConfigGroup).Args(componentId);

Mock factoryMockChildren = MockManager.Mock(typeof(ConfigurationGroupChildrenRepository));
factoryMockChildren.ExpectAndReturn("FindConfigurationGroupChildren", mockListConfigGroupChildren).Args(0);

//TODO: desperately need help on this - the call to the mocked method below is bombing with a CLR/runtime exception
Mock factoryMockConfig = MockManager.Mock(typeof(ConfigurationRepository), true);
factoryMockConfig.ExpectAndReturn("FindConfigurationsByConfigurationGroupId", mockListConfigs).Args(1);

//FindConfigurationsByConfigurationGroupId
ConfigurationGroupsByComponentIdManager manager = new ConfigurationGroupsByComponentIdManager("");
actual = manager.GetConfigurationGroupsByComponentId(componentId);

Assert.IsNotNull(actual, "Null was returned");
Assert.AreEqual(expected, actual, "TriadFinancial.ApplicationAdmin.Model.BusinessLogic.ConfigurationGroupsByComponen" +
"tIdManager.GetConfigurationGroupsByComponentId did not return the expected value" +
".");
}

Thanks.
answered by csustek (4k points)
0 votes
Hi
Sorry :oops:
I didn't explain myself well on section 2.
I mean can you post the script that runs the test that is using TypeMock
answered by ohad (35.4k points)
0 votes
Hi
Sorry :oops:
I didn't explain myself well on section 2.
I mean can you post the script that runs the test that is using TypeMock


I am using Visual Studio 2005 to run all tests.
answered by csustek (4k points)
0 votes
Hi
Can you please run the tests with TypeMock log enabled and send it to me?
I will send my address offline.

To enable log follow this steps:
Go to Start -> programs -> TypeMock.NET -> TypeMock Configuration
Select the Visual Studio tab.
Check the log Check Box.
answered by ohad (35.4k points)
...