public void SaveAndLoad() { using var stream = new MasterMemoryStream(); var documentService = Get <MockDocumentService>(); documentService.GetStreamAction = (documentPartPath, contentType, fileMode) => { stream.Position = 0; return(stream); }; var controller = Get <ModuleController>(); controller.Initialize(); controller.Run(); var root1 = controller.Root; root1.EmailAccounts.First().Name = "Test name"; controller.Shutdown(); controller.Initialize(); controller.Run(); var root2 = controller.Root; Assert.AreNotSame(root1, root2); Assert.AreEqual("Test name", root2.EmailAccounts.First().Name); controller.Shutdown(); stream.MasterDispose(); }
public void SaveAndLoad() { var stream = new MasterMemoryStream(); var documentService = Container.GetExportedValue<MockDocumentService>(); documentService.GetStreamAction = (documentPartPath, contentType, fileMode) => { stream.Position = 0; return stream; }; var controller = Container.GetExportedValue<ModuleController>(); controller.Initialize(); controller.Run(); var root1 = controller.Root; root1.EmailAccounts.First().Name = "Test name"; controller.Shutdown(); controller.Initialize(); controller.Run(); var root2 = controller.Root; Assert.AreNotSame(root1, root2); Assert.AreEqual("Test name", root2.EmailAccounts.First().Name); controller.Shutdown(); stream.MasterDispose(); }
public void SaveAndLoad() { var stream = new MasterMemoryStream(); var documentService = Get <MockDocumentService>(); documentService.GetStreamAction = (_, _, _) => { stream.Position = 0; return(stream); }; var controller = Get <ModuleController>(); controller.Initialize(); controller.Run(); var root1 = controller.Root; root1.Contacts[0].Firstname = "Test name"; controller.Shutdown(); controller.Initialize(); controller.Run(); var root2 = controller.Root; Assert.AreNotSame(root1, root2); Assert.AreEqual("Test name", root2.Contacts[0].Firstname); controller.Shutdown(); stream.MasterDispose(); }