Comments (7)
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.
from fake-xrm-easy.
Many Thanks Jordi, just realised that, thanks for your immediately reply.
from fake-xrm-easy.
No worries
from fake-xrm-easy.
fakedContext.GetDefaultPluginContext().InitiatingUserId and PluginExecutionContext.InitiatingUserId within the plugin code are not matching, any idea.
from fake-xrm-easy.
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.
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.
Grand! You're welcome.
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.