Created
February 20, 2013 11:53
-
-
Save chester89/4995001 to your computer and use it in GitHub Desktop.
Moq setup for a method that takes base class parameter
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
public class when_car_was_stolen: claim_fixture | |
{ | |
Because of = () => | |
{ | |
model.Risk = RiskTypes.Theft; | |
responsibleGuid = responsibleId; | |
workitemRepo.Setup(x => x.Add(MockIt.Is<SendEmailWorkItem>(wi => wi.ResponsibleId == responsibleGuid))).Verifiable(); | |
workitemRepo.Setup(x => x.Add(MockIt.Is<WorkItem>(wi => wi.TaskType == (int)TaskTypes.CreateClaim && wi.ResponsibleId == responsibleGuid))).Verifiable(); | |
controller.DamageClaim(model); | |
}; | |
private It should_add_new_claim_workitem = () => | |
{ | |
workitemRepo.Verify(x => x.Add(MockIt.Is<WorkItem>(wi => wi.TaskType == (int)TaskTypes.CreateClaim)), Times.Once()); | |
}; | |
private It should_add_security_service_notification_workitem_with_same_responsible_as_new_claim = () => | |
{ | |
workitemRepo.Verify(x => x.Add(MockIt.Is<SendEmailWorkItem>(wi => wi.ResponsibleId == responsibleGuid)), Times.Once()); | |
}; | |
private static Guid responsibleGuid; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment