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(); | 
  
    
      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
    
  
  
    
  | [SetUp] | |
| public void Setup() | |
| { | |
| this.PipelineContextMock.Setup(p => p.UserId).Returns(Guid.NewGuid); | |
| this.PipelineContextMock.Setup(p => p.PrimaryEntityName).Returns("contact"); | |
| this.PipelineContextMock.Setup(p => p.Stage).Returns(STAGE_PREVALIDATION); | |
| } | 
  
    
      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
    
  
  
    
  | protected void ExecutePreValidateContactDelete(LocalPluginContext localContext) | |
| { | |
| if (localContext == null) | |
| { | |
| throw new ArgumentNullException("localContext"); | |
| } | |
| _service = localContext.OrganizationService; | |
| EntityReference contact = (EntityReference)localContext.PluginExecutionContext.InputParameters["Target"]; | 
  
    
      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
    
  
  
    
  | using System; | |
| using System.Collections.Generic; | |
| using Microsoft.Xrm.Sdk; | |
| using Microsoft.Xrm.Sdk.Messages; | |
| using Microsoft.Xrm.Sdk.Metadata; | |
| using Moq; | |
| namespace X1bplan.PluginTesting.Plugins.Tests.Helpers | |
| { | |
| public abstract class PluginTestBase | 
  
    
      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
    
  
  
    
  | CreateEntityRequest createrequest = new CreateEntityRequest | |
| { | |
| //Define the entity | |
| Entity = new EntityMetadata | |
| { | |
| SchemaName = _customEntityName, | |
| DisplayName = new Label("Bank Account", 1033), | |
| DisplayCollectionName = new Label("Bank Accounts", 1033), | |
| Description = new Label("An entity to store information about customer bank accounts", 1033), | 
  
    
      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
    
  
  
    
  | > curl http://localhost:51307/api/tasks -X POST -d "id=2&subject=test&description=blah" -v | |
| > POST /api/tasks HTTP/1.1 | |
| > User-Agent: curl/7.23.1 (x86_64-pc-win32) libcurl/7.23.1 OpenSSL/0.9.8r zlib/1.2.5 | |
| > Host: localhost:51307 | |
| > Accept: */* | |
| > Content-Length: 34 | |
| > Content-Type: application/x-www-form-urlencoded | |
| > | |
| * upload completely sent off: 34 out of 34 bytes | 
  
    
      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
    
  
  
    
  | > curl http://localhost:51307/api/tasks/2 -X DELETE -v | |
| > DELETE /api/tasks/2 HTTP/1.1 | |
| > User-Agent: curl/7.23.1 (x86_64-pc-win32) libcurl/7.23.1 OpenSSL/0.9.8r zlib/1.2.5 | |
| > Host: localhost:51307 | |
| > Accept: */* | |
| > | |
| < HTTP/1.1 200 OK | |
| < Cache-Control: no-cache | |
| < Pragma: no-cache | 
  
    
      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
    
  
  
    
  | > curl http://localhost:51307/api/tasks -H "Accept: application/xml" | |
| <ArrayOfTask xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/TaskMana | |
| ger.Models"><Task><Description>Some interestingish text</Description><Id>1</Id><Subject>Test</Subject></Task><Task><Desc | |
| ription>Some more text</Description><Id>2</Id><Subject>Test 2</Subject></Task></ArrayOfTask> | 
  
    
      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
    
  
  
    
  | > curl http://localhost:51307/api/tasks/1 -i | |
| HTTP/1.1 200 OK | |
| Cache-Control: no-cache | |
| Pragma: no-cache | |
| Content-Type: application/json; charset=utf-8 | |
| Expires: -1 | |
| Server: Microsoft-IIS/8.0 | |
| X-AspNet-Version: 4.0.30319 | |
| X-SourceFiles: =?UTF-8?B?RDpcU09VUkNFXHBsdXJhbHNpZ2h0XG12YzRcVGFza01hbmFnZXJcVGFza01hbmFnZXJcYXBpXHRhc2tzXDE=?= | 
  
    
      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
    
  
  
    
  | > curl http://localhost:51307/api/tasks -v | |
| > GET /api/tasks HTTP/1.1 | |
| > User-Agent: curl/7.23.1 (x86_64-pc-win32) libcurl/7.23.1 OpenSSL/0.9.8r zlib/1.2.5 | |
| > Host: localhost:51307 | |
| > Accept: */* | |
| > | |
| < HTTP/1.1 200 OK | |
| < Cache-Control: no-cache | |
| < Pragma: no-cache |