Comments (7)
Updating the Fetchxml with a filter criteria (shown below) to overcome the error above,
<link-entity name='businessunit' from='businessunitid' to='businessunitid' alias='bu' intersect='true' >
<attribute name='name' />
<filter type='and'>
<condition attribute='name' operator='eq' value='#Name#' />
</filter>
</link-entity>
Ending up with the following error: Collection was modified; enumeration operation may not execute.
Stack Trace: at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.Dictionary2.KeyCollection.Enumerator.MoveNext() at FakeXrmEasy.Extensions.EntityExtensions.JoinAttributes(Entity e, Entity otherEntity, ColumnSet columnSet, String alias, XrmFakedContext context) at lambda_method(Closure , Entity , Entity ) at System.Linq.Enumerable.<JoinIterator>d__61
4.MoveNext()
at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() at System.Collections.Generic.List
1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable
1 source)
at FakeXrmEasy.FakeMessageExecutors.RetrieveMultipleRequestExecutor.Execute(OrganizationRequest req, XrmFakedContext ctx)
at FakeXrmEasy.XrmFakedContext.<>c__DisplayClass59_0.b__0(OrganizationRequest req)
at FakeItEasy.ReturnValueConfigurationExtensions.<>c__DisplayClassd2.<ReturnsLazily>b__c(IFakeObjectCall call) at FakeItEasy.Configuration.RuleBuilder.ReturnValueConfiguration
1.<>c__DisplayClass8.b__7(IInterceptedFakeObjectCall x)
at FakeItEasy.Configuration.BuildableCallRule.Apply(IInterceptedFakeObjectCall fakeObjectCall)
at FakeItEasy.Core.FakeManager.ApplyRule(CallRuleMetadata rule, IInterceptedFakeObjectCall fakeObjectCall)
at FakeItEasy.Core.FakeManager.FakeItEasy.Core.IFakeCallProcessor.Process(IWritableFakeObjectCall fakeObjectCall)
from fake-xrm-easy.
Hi @krishire
Could you please provide the entire unit test? I'd like to know what entities / input are you using in your test (ones passed to the .Initialize()).
Cheers,
from fake-xrm-easy.
public void FirstCodeActivityTest()
{
var fakedContext = new XrmFakedContext {};
var fakedWorkflowContext = fakedContext.GetDefaultWorkflowContext();
fakedContext.ProxyTypesAssembly = Assembly.GetAssembly(typeof(BusinessUnit));
var entityAccount = new Account { Id = Guid.NewGuid(), Name = "My First Faked Account yeah!", LogicalName = "account" };
var entityContact = new Contact { Id = Guid.NewGuid(),ParentCustomerId = entityAccount.ToEntityReference() };
var entityBusinessUnit = new BusinessUnit { Name="TestBU", BusinessUnitId = Guid.NewGuid() };
var initiatingUser = new SystemUser
{
Id = fakedWorkflowContext.InitiatingUserId,
FirstName = "TestUser",
DomainName = "TestDomain",
BusinessUnitId = entityBusinessUnit.ToEntityReference()
};
fakedContext.Initialize(new List<Entity>() {
entityBusinessUnit,entityAccount,entityContact,initiatingUser
});
fakedWorkflowContext.PrimaryEntityName = "contact";
fakedWorkflowContext.PrimaryEntityId = entityContact.Id;
var fakedActivity = fakedContext.ExecuteCodeActivity(fakedWorkflowContext, new Dictionary<string, object>(), new TestCodeActivity());
//Assert that the target contains the required change
}
from fake-xrm-easy.
though the fetchxml expression is executed successfully, still not able to use the linked entity attribute in this fashion
UserResponseCoreObject.GetAttributeValue("bu.name").Value
from fake-xrm-easy.
jordi,
Though the fetchxml expression is executed successfully, still not able to
use the linked entity attribute in this fashion
UserResponseCoreObject.GetAttributeValue<AliasedValue>("bu.rbsm_defaultcontactrole").Value
Am I missing something.
Thanks,
Krish.
On Fri, Jun 10, 2016 at 4:00 PM, Jordi [email protected] wrote:
Closed #70 #70
via 4c17b0e
4c17b0e
.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#70 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AQJF8KwcIk3AXxVmwYX6FUUdCKGgLNKWks5qKXwVgaJpZM4IwGlh
.
from fake-xrm-easy.
Very much thankful to you.
Regards,
Krish.
On Sun, Jun 12, 2016 at 4:10 PM, Jordi [email protected] wrote:
Closed #70 #70
via 101234a
101234a
.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#70 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AQJF8MxvLQag6D7TSqNQJzhpxbAsKAqHks5qLCFbgaJpZM4IwGlh
.
from fake-xrm-easy.
Hi @krishire
Thanks for spotting that.
There is a step to translate the FetchXml query into a QueryExpression, which is then executed, and that one was generating the LinkTo attribute with the LinkFrom and the LinkFrom with the LinkTo attributes, so they were swapped. That was fixed in this commit.
The FetchXml query execution still needs some tweaking, cause it is more recent than QueryExpressions and LINQ implementations so please do let me know if you are still having issues like this one.
Regards,
from fake-xrm-easy.
Related Issues (20)
- Fakecontext isn't updating after target change plugin executed HOT 1
- Query on associatedentitytypecode should work with both Entity Name and ObjectTypeCode HOT 5
- ConditionOperator.LessThan is throwing error "Specified Cast is not valid" for DateTimeField HOT 3
- NullReferenceException registering Plugin in simulated pipeline HOT 10
- RetrieveEntityDataSource is returning null value HOT 3
- Announcing public preview of FakeXrmEasy v2.x! HOT 1
- The specified service type is not supported when using Microsoft.Xrm.Sdk.PluginTelemetry. HOT 2
- Complex filter works in main entity, but not in nested entity.
- Is the Microsoft.PowerPlatform.Dataverse.Client supported? HOT 1
- ThisMonth in Query Expression fails on last day after midday
- ExecutePluginWith<T>(...) has no parameter for MessageName - need to use obselete method ExecutePluginWithTargetAndPreEntityImages<T>(...) HOT 2
- In Code Activity Logical Name does not exist HOT 1
- `type argument 'FakeXrmEasyUpdatePluginCrash.MyPlugin' violates the constraint of type parameter 'T'.` HOT 3
- Couldnt find reflected type for sdkmessageprocessingstepimage HOT 2
- ServiceClient not working with CrmServiceContext from Early Bound Generated Class HOT 2
- Object reference not set to an instance of an object.
- Filters with like condition throw 'Object reference not set to an instance of an object.'
- Add Support for ExecuteTransactionRequest
- Should support Operators where early bound types for a multi option set (i.e. multiple choice) is generated as an IEnumberable<TEnum> as opposed to an OptionSetValueCollection
- FetchXml StateCode Specified Cast is not Valid
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fake-xrm-easy.