Skip to content

Commit

Permalink
Added DeleteRecordChangeHistoryRequest Fake executor for Shared project.
Browse files Browse the repository at this point in the history
Added DeleteRecordChangeHistoryRequestTest Fake executor for Test Shared project.
  • Loading branch information
Victor Sanchez authored and Victor Sanchez committed Jan 8, 2021
1 parent f294b9a commit f00f716
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Microsoft.Xrm.Sdk;
using Microsoft.Crm.Sdk.Messages;
using System;
using System.ServiceModel;
namespace FakeXrmEasy.FakeMessageExecutors
{
public class DeleteRecordChangeHistoryRequestExecutor : IFakeMessageExecutor
{

public bool CanExecute(OrganizationRequest request)
{
return request is DeleteRecordChangeHistoryRequest;
}

public OrganizationResponse Execute(OrganizationRequest request, XrmFakedContext ctx)
{
var req = request as DeleteRecordChangeHistoryRequest;

var res = new DeleteRecordChangeHistoryResponse();

return res;
}

public Type GetResponsibleRequestType()
{
return typeof(DeleteRecordChangeHistoryRequest);
}
}

}
1 change: 1 addition & 0 deletions FakeXrmEasy.Shared/FakeXrmEasy.Shared.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Extensions\TypeExtensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Extensions\XmlExtensionsForFetchXml.cs" />
<Compile Include="$(MSBuildThisFileDirectory)FakeMessageExecutors\AddListMembersListRequestExecutor.cs" />
<Compile Include="$(MSBuildThisFileDirectory)FakeMessageExecutors\DeleteRecordChangeHistoryRequestExecutor.cs" />
<Compile Include="$(MSBuildThisFileDirectory)FakeMessageExecutors\FetchXmlToQueryExpressionRequestExecutor.cs" />
<Compile Include="$(MSBuildThisFileDirectory)FakeMessageExecutors\RetrieveExchangeRateRequest.cs" />
<Compile Include="$(MSBuildThisFileDirectory)FakeMessageExecutors\BulkDeleteRequestExecutor.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using FakeXrmEasy.FakeMessageExecutors;
using Microsoft.Crm.Sdk.Messages;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Messages;
using Xunit;

namespace FakeXrmEasy.Tests.FakeContextTests.DeleteRecordChangeHistoryRequestTests
{
public class DeleteRecordChangeHistoryRequestTests
{
[Fact]
public void When_can_execute_is_called_with_an_invalid_request_result_is_false()
{
var executor = new DeleteRecordChangeHistoryRequestExecutor();
var anotherRequest = new RetrieveMultipleRequest();
Assert.False(executor.CanExecute(anotherRequest));
}

[Fact]
public void When_execute_is_called_with_a_null_target_exception_is_thrown()
{
var ctx = new XrmFakedContext();
var service = ctx.GetOrganizationService();
var orgReq = new OrganizationRequest();
var res = new DeleteRecordChangeHistoryRequestExecutor().Execute(orgReq, ctx);
Assert.IsType(typeof(DeleteRecordChangeHistoryResponse), res);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<Compile Include="$(MSBuildThisFileDirectory)FakeContextTests\AddListMembersListRequestTests\Tests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)FakeContextTests\AddMemberListRequestTests\Tests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)FakeContextTests\BulkDeleteRequestTests\BulkDeleteRequestTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)FakeContextTests\DeleteRecordChangeHistoryRequestTests\DeleteRecordChangeHistoryRequestTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)FakeContextTests\FetchXmlToQueryExpressionRequestTests\FetchXmlToQueryExpressionRequestTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)FakeContextTests\QueryTranslationTests\ProjectionTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)FakeContextTests\RemoveUserFromRecordTeamRequestTests\RemoveUserFromRecordTeamRequestTests.cs" />
Expand Down

0 comments on commit f00f716

Please sign in to comment.