Cloud-Awesome / dataverse-simulate

Mock framework to simulate Dataverse (Power Platform/Dynamics 365 CE) environments for unit testing
GNU General Public License v3.0
1 stars 0 forks source link

Pass Simulator Options into the re-initialise method #294

Closed Cloud-Awesome closed 10 months ago

Cloud-Awesome commented 10 months ago

So that it knows what basis to initialise from.

Also allows tests to update and pass in a different plugin execution context (to be added to the simulator options class)

/// <summary> 
/// Clears data created, updated or deleted in a test and resets to the original configuration  
/// (Either an empty dataset, or initialised from base mock) 
/// </summary> 
public void Reinitialise() 
{ 
    /* 
     * TODO - Clear and then reload stuff we want to keep 
     *  - Reference to a user 
     *  - BUs, Teams, Fiscal Periods, etc... 
     */

     MockedEntityDataStore.Instance.Data.Clear(); 
}
Cloud-Awesome commented 10 months ago

Consider having another method which only re-initialises the plugin context, not the whole singleton

i.e.

public void Reinitialise(SimulatorOptions options) { ...}

public void Reinitialise(MockedPluginExecutionContext pluginContext) { ... }