/// <summary> /// When code is build in the 'debug' configuration CLR doesn't collect the object till exiting a visibility scope, /// even if it is not referenced, in contrast with 'release' configuration when object is collected as soon /// as it is not referenced by any root. /// This method is need To eliminate this difference and make the test stable by isolating variable /// 'target' visibility scope. /// </summary> private static void RunAndShutdownApplication() { // --arrange var target = new ComponentContainer(); target.CreateMainViewModel(); // --act target.Dispose(); }
public void ShutdownTest() { // --arrange var target = new ComponentContainer(); target.CreateMainViewModel(); // --act target.Dispose(); // --assert dotMemory.Check(memory => { var allMyObjects = memory .GetObjects(where => @where.Type.IsNot <ComponentContainer>()) .GetObjects(where => @where.Namespace.Like("GameOfLife.*")); Assert.That(allMyObjects.ObjectsCount, Is.EqualTo(1)); // var allowedObject = allMyObjects. }); dotMemoryApi.SaveCollectedData(); }