Skip to content

Commit

Permalink
Merge pull request #32 from DynamicsValue/new-messages
Browse files Browse the repository at this point in the history
New messages
  • Loading branch information
jordimontana82 authored Mar 3, 2024
2 parents 4791114 + 8cd5f55 commit c1f06f7
Show file tree
Hide file tree
Showing 27 changed files with 845 additions and 149 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
## [2.5.0]

### Added

- **Minor Breaking Change**: Generic Message executors have been moved to *FakeXrmEasy.FakeMessageExecutors.GenericExecutors* namespace for consistency with their own interface name
- Add ExportPdfDocumentExecutor - https://github.com/DynamicsValue/fake-xrm-easy/issues/125
- Add RetrieveCurrentOrganizationRequest executor - https://github.com/DynamicsValue/fake-xrm-easy/issues/136

### Changed

- Introduces validation error when trying to add a user to a default team - https://github.com/DynamicsValue/fake-xrm-easy/issues/108
- Fixes responsible type in CloseIncidentRequestExecutor - https://github.com/DynamicsValue/fake-xrm-easy/issues/116
- Increase code coverage for NavigateToNextEntityOrganizationRequest
- Remove unnecessary checks in NavigateToNextEntityOrganizationRequestExecutor: thanks Temmy

## [2.4.0]

## Added
Expand Down
2 changes: 2 additions & 0 deletions FakeXrmEasy.Messages.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=isdefault/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#if FAKE_XRM_EASY_9 || FAKE_XRM_EASY_365 || FAKE_XRM_EASY_2016 || FAKE_XRM_EASY_2015

using Microsoft.Xrm.Sdk.Organization;

namespace FakeXrmEasy.Messages.ContextProperties
{
/// <summary>
/// Stores information about the current organization details
/// </summary>
public class CurrentOrganizationDetails
{
/// <summary>
/// The organization details
/// </summary>
public OrganizationDetail Details { get; set; }
}
}
#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;

namespace FakeXrmEasy.Messages.Exceptions.ExportPdfDocumentRequest
{
/// <summary>
/// Exception raised when the EntityTypeCode parameter is missing
/// </summary>
public class EntityTypeCodeNotSpecifiedException: Exception
{
/// <summary>
/// Default constructor
/// </summary>
public EntityTypeCodeNotSpecifiedException() : base("When executing ExportPdfDocument request, EntityTypeCode parameter is required but was not specified")
{

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;

namespace FakeXrmEasy.Messages.Exceptions.ExportPdfDocumentRequest
{
/// <summary>
/// Exception raised when the EntityTypeCode parameter is not a valid integer
/// </summary>
public class EntityTypeCodeNotValidException: Exception
{
/// <summary>
/// Default constructor
/// </summary>
public EntityTypeCodeNotValidException() : base("When executing ExportPdfDocument request, EntityTypeCode parameter is required but is not valid")
{

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;

namespace FakeXrmEasy.Messages.Exceptions.ExportPdfDocumentRequest
{
/// <summary>
/// Exception raised when the SelectedRecords parameter doesn't have a valid format
/// </summary>
public class SelectedRecordsIsNotValidException: Exception
{
/// <summary>
/// Default constructor
/// </summary>
public SelectedRecordsIsNotValidException() : base("When executing ExportPdfDocument request, SelectedRecords parameter is required but not valid. Must be a string representation of an array of Guid's")
{

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;

namespace FakeXrmEasy.Messages.Exceptions.ExportPdfDocumentRequest
{
/// <summary>
/// Exception raised when the SelectedRecords parameter is valid but not found
/// </summary>
public class SelectedRecordsNotFoundException: Exception
{
/// <summary>
/// Default constructor
/// </summary>
public SelectedRecordsNotFoundException() : base("When executing ExportPdfDocument request, SelectedRecords parameter was specified but at least one record was not found")
{

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;

namespace FakeXrmEasy.Messages.Exceptions.ExportPdfDocumentRequest
{
/// <summary>
/// Exception raised when the SelectedRecords parameter is missing
/// </summary>
public class SelectedRecordsNotSpecifiedException: Exception
{
/// <summary>
/// Default constructor
/// </summary>
public SelectedRecordsNotSpecifiedException() : base("When executing ExportPdfDocument request, SelectedRecords parameter is required but was not specified")
{

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;

namespace FakeXrmEasy.Messages.Exceptions.ExportPdfDocumentRequest
{
/// <summary>
/// Exception raised when the SelectedTemplate was specified but not a valid EntityReference
/// </summary>
public class SelectedTemplateMustBeEntityReferenceException: Exception
{
/// <summary>
/// Default constructor
/// </summary>
public SelectedTemplateMustBeEntityReferenceException() : base("When executing ExportPdfDocument request, SelectedTemplate must be an EntityReference to a document template record")
{

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;

namespace FakeXrmEasy.Messages.Exceptions.ExportPdfDocumentRequest
{
/// <summary>
/// Exception raised when the SelectedTemplate was specified but not found (it doesn't exists)
/// </summary>
public class SelectedTemplateNotFoundException: Exception
{
/// <summary>
/// Default constructor
/// </summary>
public SelectedTemplateNotFoundException() : base("When executing ExportPdfDocument request, a SelectedTemplate was specified in the request but not found")
{

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;

namespace FakeXrmEasy.Messages.Exceptions.ExportPdfDocumentRequest
{
/// <summary>
/// Exception raised when the SelectedTemplate parameter is missing
/// </summary>
public class SelectedTemplateNotSpecifiedException: Exception
{
/// <summary>
/// Default constructor
/// </summary>
public SelectedTemplateNotSpecifiedException() : base("When executing ExportPdfDocument request, SelectedTemplate parameter is required but was not specified")
{

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;

namespace FakeXrmEasy.Messages.Exceptions.NavigateToNextEntityOrganizationRequest
{
/// <summary>
/// Exception raised when the entity record of the current stage associated to a given business process does not exist
/// </summary>
public class CurrentEntityNotFoundException: Exception
{
/// <summary>
/// Default constructor
/// </summary>
/// <param name="logicalName"></param>
/// <param name="id"></param>
public CurrentEntityNotFoundException(string logicalName, Guid id):
base($"There is no current entity record with logical name '{logicalName}' and Id '{id}'")
{

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;

namespace FakeXrmEasy.Messages.Exceptions.NavigateToNextEntityOrganizationRequest
{
/// <summary>
/// Exception raised when the record of the the next stage in a given business process does not exist
/// </summary>
public class NextEntityNotFoundException: Exception
{
/// <summary>
/// Default constructor
/// </summary>
/// <param name="logicalName"></param>
/// <param name="id"></param>
public NextEntityNotFoundException(string logicalName, Guid id):
base($"There is no next entity record with logical name '{logicalName}' and Id '{id}'")
{

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ public OrganizationResponse Execute(OrganizationRequest request, IXrmFakedContex
throw FakeOrganizationServiceFaultFactory.New(ErrorCodes.ObjectDoesNotExist, string.Format("Team with Id {0} wasn't found", req.TeamId.ToString()));
}

if (team.GetAttributeValue<bool?>("isdefault") == true)
{
throw FakeOrganizationServiceFaultFactory.New(ErrorCodes.CannotAddMembersToDefaultTeam, "You cannot join one or more of the teams selected. The membership of default teams cannot be modified.");
}

foreach (var memberId in req.MemberIds)
{
var user = ctx.CreateQuery("systemuser").FirstOrDefault(e => e.Id == memberId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public OrganizationResponse Execute(OrganizationRequest request, IXrmFakedContex
/// <returns></returns>
public Type GetResponsibleRequestType()
{
return typeof(CloseIncidentResponse);
return typeof(CloseIncidentRequest);
}
}
}
Loading

0 comments on commit c1f06f7

Please sign in to comment.