Defines the MockDirectoryInfoFactory type.
Inheritance: IDirectoryInfoFactory
コード例 #1
0
        public void Initialize()
        {
            this.mockPluginsService = new Mock<IPluginsService>();
            this.mockFileSystem = new Mock<IFileSystem>();
            this.mockSettingsService = new Mock<ISettingsService>();
            this.mockPluginsTranslator = new Mock<ITranslator<Tuple<DirectoryInfoBase, DirectoryInfoBase>, Plugins>>();
            this.mockPluginTranslator = new Mock<ITranslator<FileInfoBase, Plugin>>();

            MockDirectoryInfoFactory mockDirectoryInfoFactory = new MockDirectoryInfoFactory();
            this.mockFileSystem.SetupGet(x => x.DirectoryInfo).Returns(mockDirectoryInfoFactory);

            MockDirectory mockDirectory = new MockDirectory { DirectoryExists = true };
            this.mockFileSystem.SetupGet(x => x.Directory).Returns(mockDirectory);

            this.factory = new PluginFactory(
                this.mockPluginsService.Object,
                this.mockFileSystem.Object,
                this.mockSettingsService.Object,
                this.mockPluginsTranslator.Object,
                this.mockPluginTranslator.Object);
        }
コード例 #2
0
        public void TestRun()
        {
            this.mockSettingsService.SetupGet(x => x.UseNugetForPlugins).Returns(true);
            this.mockVisualStudioService.SetupGet(x => x.IsMvvmCrossSolution).Returns(true);

            PluginsForm pluginsForm = new PluginsForm(new SettingsService(), new List<string>(),  new Plugins());

            this.mockFormsService.Setup(x => x.GetPluginsForm(
                It.IsAny<ISettingsService>(),
                It.IsAny<IEnumerable<string>>(),
                It.IsAny<Plugins>())).Returns(pluginsForm);

            this.mockDialogService.Setup(x => x.ShowDialog(It.IsAny<Form>())).Returns(DialogResult.OK);

            MockDirectoryInfoFactory mockDirectoryInfoFactory = new MockDirectoryInfoFactory();
            this.mockFileSystem.SetupGet(x => x.DirectoryInfo).Returns(mockDirectoryInfoFactory);

            this.mockSettingsService.SetupGet(x => x.CorePluginsPath).Returns("path");

            Mock<IProjectService> mockProjectService = new Mock<IProjectService>();

            this.mockVisualStudioService.SetupGet(x => x.CoreProjectService).Returns(mockProjectService.Object);

            this.controller.Run();
        }