Git Product home page Git Product logo

Comments (7)

jordimontana82 avatar jordimontana82 commented on May 23, 2024 2

Hi @krishire

You don't need to mock those methods, they are already "mocked", which is the point of the framework.

The only thing you need to do is to get an instance of a fake organization service like this

var context = new XrmFakedContext();
var service = context.GetFakedOrganizationService();

//Then setup your initial state with a single system user, for example
context.Initialize(new List<Entity>() {
    new SystemUser() { Id = Guid.NewGuid(), DomainName = "Domain", Fullname = "Some name" };
});

//After this, any call to service.Retrieve or service.RetrieveMultiple will return that user provided conditions in the query (filters, joins, etc) are satisfied.

More examples here and here

from fake-xrm-easy.

krishire avatar krishire commented on May 23, 2024

Many Thanks Jordi, just realised that, thanks for your immediately reply.

from fake-xrm-easy.

jordimontana82 avatar jordimontana82 commented on May 23, 2024

No worries

from fake-xrm-easy.

krishire avatar krishire commented on May 23, 2024

fakedContext.GetDefaultPluginContext().InitiatingUserId and PluginExecutionContext.InitiatingUserId within the plugin code are not matching, any idea.

from fake-xrm-easy.

jordimontana82 avatar jordimontana82 commented on May 23, 2024

Hi @krishire

Could you please provide a unit test to reproduce this?

From the GetDefaultPluginContext implementation, it should retrieve the one you passed to the context, or, a default one, if it was empty

from fake-xrm-easy.

krishire avatar krishire commented on May 23, 2024

Thanks a lot Again Jordi, found the issue in my code, re-initialised the initiatingUserId in the context, after creating the required base record using the default plugin context's intiatingUserId value.

from fake-xrm-easy.

jordimontana82 avatar jordimontana82 commented on May 23, 2024

Grand! You're welcome.

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.