Git Product home page Git Product logo

Comments (7)

krishire avatar krishire commented on May 25, 2024

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__614.MoveNext()
at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 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.ReturnValueConfiguration1.<>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.

jordimontana82 avatar jordimontana82 commented on May 25, 2024

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.

krishire avatar krishire commented on May 25, 2024
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.

krishire avatar krishire commented on May 25, 2024

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.

krishire avatar krishire commented on May 25, 2024

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.

krishire avatar krishire commented on May 25, 2024

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.

jordimontana82 avatar jordimontana82 commented on May 25, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.