I use (or try) the Silverlight unittesting.
everything seems alright but the methods taged with attribute [TestInitialize]
are not called before the [TestMethod]
. Anyone knows a workaround ?
here is a sample where Method BeforeAnyTest is never called:
[TestClass]
public class TViewModel
{
protected MockRepository MockRepository { get; set; }
/// <summary>
/// This is strangely not called automatically before any test
/// </summary>
[TestInitialize]
protected void BeforeAnyTest()
{
MockRepository = new MockRepository();
}
[TestMethod]
public void TServerStartupViewModelCtor()
{
//BeforeAnyTest();
var smsa = MockRepository.StrictMock<IServerManagementServiceAgent>();
ServerStartupViewModel ssvm = new ServerStartupViewModel(smsa);
Assert.IsNotNull(ssvm);
}
}
Try to define it as public
instead of protected
ie:
[TestInitialize]
public void BeforeAnyTest()
{
MockRepository = new MockRepository();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With