Last active
December 14, 2015 00:19
-
-
Save erikdietrich/4998372 to your computer and use it in GitHub Desktop.
Demonstration of the Mock/regular conflict in Moq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private ISomeService Service { get; set; } | |
[TestMethod, Owner("ebd"), TestCategory("Proven"), TestCategory("Unit")] | |
public void SomeTest() | |
{ | |
Service = Mock.Of<ISomeService>(); | |
//I want to inject it as if it were just some service | |
Target = new SomeClassUnderTest(Service); | |
//But then I want to configure the meta-behavior around the mock also | |
Mock.Get(Service).Setup(serv => serv.Create(It.IsAny<Entity>())).Throws(new Exception()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment