Following the directions at: http://www.telerik.com/help/justmock/advanced-usage-static-mocking.html
I'm unsuccessful in mocking ConfigurationManager.AppSettings. Here's the code I'm using...
[TestMethod]
public void my_test()
{
// Arrange
var appSettings = new NameValueCollection {
{ "test1", "one" }
};
Mock.Arrange(() => ConfigurationManager.AppSettings)
.Returns(appSettings)
.MustBeCalled();
// Act
var test1 = ConfigurationManager.AppSettings["test1"];
// Assert
Assert.AreEqual("one", test1);
}
This is the error I receive.
Assert.AreEqual failed. Expected:. Actual:<(null)>.
Is it possible to mock this object?
[edit] I'm also using the Trial.
Official response is, this appears to be an issue with MSTest only.