Пример #1
0
        public void Initialize_WhenLoadOnStartup_Loads()
        {
            _mockLocator.Setup(x => x.LoadOnStartup).Returns(true);
            _mockLocator.Setup(x => x.Path).Returns(ExamplePath);

            FileBackingStoreService test = BuildDefaultFileBackingStoreService();

            test.Initialize();

            _mockSerializer.Verify(x => x.Load(It.IsAny <Stream>(), It.IsAny <IEnumerable <Type> >()));
        }
Пример #2
0
        public void Initialize_WorkspaceFileIsMissing_KeepsDefaultWorkspace(Type exceptionType)
        {
            _mockLocator.Setup(x => x.LoadOnStartup).Returns(true);
            _mockLocator.Setup(x => x.Path).Returns(ExamplePath);
            _mockSerializer.Setup(x => x.Load(It.IsAny <Stream>(), It.IsAny <IEnumerable <Type> >())).Throws(
                (Exception)Activator.CreateInstance(exceptionType));

            FileBackingStoreService test = BuildDefaultFileBackingStoreService();

            test.Initialize();

            Assert.Same(_workspace, test.Workspace);
        }