Created
February 14, 2013 17:10
-
-
Save tswann/4954348 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| [Test] | |
| public void ShouldThrowExceptionIfOpenTaskExists() | |
| { | |
| Entity contact = new Entity() | |
| { | |
| LogicalName = "contact", | |
| Id = Guid.NewGuid() | |
| }; | |
| ParameterCollection parameters = new ParameterCollection(); | |
| parameters["Target"] = contact.ToEntityReference(); | |
| this.PipelineContextMock.Setup(p => p.InputParameters).Returns(parameters); | |
| this.PipelineContextMock.Setup(p => p.MessageName).Returns("Delete"); | |
| EntityCollection tasks = new EntityCollection() { EntityName = "task", Entities = { GetRelatedTask(contact.Id) } }; | |
| this.OrganizationServiceMock.Setup(s => s.RetrieveMultiple(It.IsAny<QueryExpression>())).Returns(tasks); | |
| PreValidateContactDelete plugin = new PreValidateContactDelete(); | |
| var exception = Assert.Throws<InvalidPluginExecutionException>(() => plugin.Execute(ServiceProviderMock.Object)); | |
| Assert.That(exception.Message, Is.StringContaining(OPEN_TASKS_EXCEPTION)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment