Following the directions here: http://www.telerik.com/help/justmock/advanced-usage-future-mocking.html
I was able to successfully Future Mock classes that I created, but I can't seem to get Future Mocking working with TfsTeamProjectCollection.
Here are two tests that are failing:
Here's a link to a sample project: http://dl.dropbox.com/u/1006254/JustMockTestProject5.zip
I was able to successfully Future Mock classes that I created, but I can't seem to get Future Mocking working with TfsTeamProjectCollection.
Here are two tests that are failing:
[TestMethod]
public
void
TfsTeamProjectCollection_Create_returns_VersionControlServer()
{
// Arrange
var tfsTeamProjectCollection = Mock.Create<TfsTeamProjectCollection>(Constructor.Mocked);
var versionControlServer = Mock.Create<VersionControlServer>();
Mock.Arrange(() => tfsTeamProjectCollection.GetService<VersionControlServer>())
.Returns(versionControlServer)
.IgnoreInstance();
var newTfsTeamProjectCollection =
new
TfsTeamProjectCollection(
new
Uri(
"about:blank"
));
// Act
var result = newTfsTeamProjectCollection.GetService<VersionControlServer>();
// Assert
Assert.AreEqual(versionControlServer, result);
}
[TestMethod]
public
void
TfsTeamProjectCollection_Create_throws_NotImplementedException()
{
// Arrange
var tfsTeamProjectCollection = Mock.Create<TfsTeamProjectCollection>(Constructor.Mocked);
var versionControlServer = Mock.Create<VersionControlServer>();
Mock.Arrange(() => tfsTeamProjectCollection.GetService<VersionControlServer>())
.Throws(
new
NotImplementedException())
.IgnoreInstance();
var newTfsTeamProjectCollection =
new
TfsTeamProjectCollection(
new
Uri(
"about:blank"
));
try
{
// Act
newTfsTeamProjectCollection.GetService<VersionControlServer>();
// Assert
Assert.Fail(
"An Exception was expected."
);
}
catch
(NotImplementedException)
{
}
Here's a link to a sample project: http://dl.dropbox.com/u/1006254/JustMockTestProject5.zip