Exemplo n.º 1
0
        protected override void Because_Of()
        {
            //mainWindowPropModel = PropModelCache.GetPropModel("MainWindowVM");

            string className = "MainWindowVM";
            string fcn       = GetFullClassName(DefaultNamespace, className, ConfigPackageNameSuffix);

            if (!PropModelCache.TryGetPropModel(fcn, out mainWindowPropModel))
            {
                throw new KeyNotFoundException($"Could not find a PropModel with Full Class Name = {fcn}.");
            }
            BaseMemTracker.CompactMeasureAndReport("After get mainWindow_PropModel.", "CreateVM_CreateMainWindowVM_Run2");

            // To see how much memory is not being cleaned up after one is created and then disposed.
            mainWindowViewModel = new MainWindowViewModel(mainWindowPropModel, ViewModelFactory, PropBagMapperService);
            BaseMemTracker.CompactMeasureAndReport("After create the first mainWindowViewModel.", "CreateVM_CreateMainWindowVM_Run2");

            mainWindowViewModel.Dispose();
            BaseMemTracker.CompactMeasureAndReport("After dispose of the first mainWindowViewModel.", "CreateVM_CreateMainWindowVM_Run2");

            mainWindowViewModel = new MainWindowViewModel(mainWindowPropModel, ViewModelFactory, PropBagMapperService);
            BaseMemTracker.CompactMeasureAndReport("After create the second mainWindowViewModel.", "CreateVM_CreateMainWindowVM_Run2");

            // And here.
            mainWindowViewModel.Dispose();
            BaseMemTracker.CompactMeasureAndReport("After dispose of the second mainWindowViewModel.", "CreateVM_CreateMainWindowVM_Run2");
        }
Exemplo n.º 2
0
        // Override the base EstablishContext so that no resources are used (and the cleanup action is null.)
        protected override Action EstablishContext()
        {
            // Take Heap SnapShot here. (CreateVM_CreateMainWindowVM_Run2 and Run3 have completed, since the first SnapShot and the Context has been cleaned up.)

            BaseMemTracker.CompactMeasureAndReport("Here at ZZZ No Resources End Run -- EstablishContext.", "CreateVM_CreateMainWindowVM_Run1");

            return(null);
        }
Exemplo n.º 3
0
        protected override void Because_Of()
        {
            //mainWindowPropModel = PropModelCache.GetPropModel("MainWindowVM");

            string className = "MainWindowVM";
            string fcn       = GetFullClassName(DefaultNamespace, className, ConfigPackageNameSuffix);

            if (!PropModelCache.TryGetPropModel(fcn, out mainWindowPropModel))
            {
                throw new KeyNotFoundException($"Could not find a PropModel with Full Class Name = {fcn}.");
            }
            BaseMemTracker.CompactMeasureAndReport("After get mainWindow_PropModel.", "CreateVM_CreateMainWindowVM_Run1");


            ViewModelFactoryInterface viewModelFactory = ViewModelFactory;

            mainWindowViewModel = new MainWindowViewModel(mainWindowPropModel, viewModelFactory, PropBagMapperService);
            BaseMemTracker.CompactMeasureAndReport("After create the mainWindowViewModel.", "CreateVM_CreateMainWindowVM_Run1");

            mainWindowViewModel.Dispose();
            BaseMemTracker.CompactMeasureAndReport("After dispose of the mainWindowViewModel.", "CreateVM_CreateMainWindowVM_Run1");
        }
Exemplo n.º 4
0
 protected void CallContextDestroyer()
 {
     BaseMemTracker.CompactMeasureAndReport("Before Context Destroyed.", "Abstract Spec.");
     Destroyer.Dispose();
     BaseMemTracker.CompactMeasureAndReport("After Context Destroyed.", "Abstract Spec.");
 }
Exemplo n.º 5
0
 protected void CallBecause_Of()
 {
     BaseMemTracker.CompactMeasureAndReport("Before Because_Of was called.", "Abstract Spec.");
     Because_Of();
     BaseMemTracker.CompactMeasureAndReport("After Because_Of was called.", "Abstract Spec.");
 }