Defines the MockFile type.
Inheritance: System.IO.Abstractions.FileBase
        public void TestBuildZipFile()
        {
            ZipArchive zipArchive = this.GetZipArchive();
            ZipArchiveEntry zipArchiveEntry = zipArchive.CreateEntry("folderName.dll");

            MockFile mockFile = new MockFile { FileExists = false };

            this.mockFileSystem.SetupGet(x => x.File).Returns(mockFile);

            this.service.BuildZipFile("updatesDirectory", "folderName", zipArchive, zipArchiveEntry);
        }
        public void TestCheckForUpdates()
        {
            SettingsService settingsService = new SettingsService();

            this.mockSettingsService.SetupGet(x => x.UpdateCheckerPath).Returns(settingsService.UpdateCheckerPath);

            MockFile mockFile = new MockFile { FileExists = true };

            this.mockFileSystem.SetupGet(x => x.File).Returns(mockFile);

            this.service.CheckForUpdates();
        }
        public void Initialize()
        {
            this.mockFileSystem = new Mock<IFileSystem>();
            this.mockSettingsService = new Mock<ISettingsService>();
            this.mockFile = new MockFile();
            this.mockFileInfoFactory = new Mock<IFileInfoFactory>();
            this.mockFileInfo = new MockFileInfo();
            this.mockCodeConfigFactory = new Mock<ICodeConfigFactory>();

            this.mockFileSystem.SetupGet(x => x.File).Returns(this.mockFile);
            this.mockFileSystem.SetupGet(x => x.FileInfo).Returns(this.mockFileInfoFactory.Object);
            this.mockFileInfoFactory.Setup(x => x.FromFileName(It.IsAny<string>())).Returns(this.mockFileInfo);

            this.service = new PluginService(this.mockSettingsService.Object);
        }
        public void Initialize()
        {
            this.mockSettingsService = new Mock<ISettingsService>();
            this.mockFileSystem = new Mock<IFileSystem>();
            this.mockTranslator = new Mock<ITranslator<string, CodeSnippet>>();

            MockFile mockFile = new MockFile { FileExists = true };

            this.mockFileSystem.SetupGet(x => x.File).Returns(mockFile);

            Mock<IFileInfoFactory> mockFileInfoFactory = new Mock<IFileInfoFactory>();

            MockFileInfoBase mockFileInfoBase = new MockFileInfoBase { LengthValue = 22 };

            mockFileInfoFactory.Setup(x => x.FromFileName(It.IsAny<string>())).Returns(mockFileInfoBase);
            this.mockFileSystem.SetupGet(x => x.FileInfo).Returns(mockFileInfoFactory.Object);

            this.service = new SnippetService(
                this.mockSettingsService.Object, this.mockFileSystem.Object, this.mockTranslator.Object);
        }
        public void TestGetSnippetUser()
        {
            MockFile mockFile = new MockFile { FileExists = true };
            this.mockFileSystem.SetupGet(x => x.File).Returns(mockFile);

            this.factory.GetSnippet("coreDirectory", "userDirectory", "FileName");

            this.mockTranslator.Verify(x => x.Translate("userDirectoryFileName"));
        }
        public void TestGetSnippet()
        {
            MockFile mockFile = new MockFile { FileExists = true };
            this.mockFileSystem.SetupGet(x => x.File).Returns(mockFile);

            this.factory.GetSnippet("path");

            this.mockTranslator.Verify(x => x.Translate(It.IsAny<string>()));
        }
        public void TestGetPluginTestSnippet()
        {
            Plugin plugin = new Plugin();

            MockFile mockFile = new MockFile { FileExists = true };
            this.mockFileSystem.SetupGet(x => x.File).Returns(mockFile);

            SettingsService settingsService = new SettingsService();

            this.mockSettingsService.SetupGet(x => x.PluginsCodeSnippetsPath).Returns(settingsService.PluginsCodeSnippetsPath);
            this.mockSettingsService.SetupGet(x => x.UserCodeSnippetsPluginsPath).Returns(settingsService.UserCodeSnippetsPluginsPath);

            this.mockTranslator.Setup(x => x.Translate(It.IsAny<string>())).Returns(new CodeSnippet());

            this.factory.GetPluginTestSnippet(plugin);

            this.mockTranslator.Verify(x => x.Translate(It.IsAny<string>()));
        }
        public void Initialize()
        {
            this.mockPluginService = new Mock<IPluginService>();
            this.mockVisualStudioService = new Mock<IVisualStudioService>();
            this.mockFileSystem = new Mock<IFileSystem>();
            this.mockSettingsService = new Mock<ISettingsService>();
            this.mockSnippetsService = new Mock<ISnippetService>();
            this.mockNugetService = new Mock<INugetService>();

            this.mockFile = new MockFile();
            this.mockFileInfoFactory = new Mock<IFileInfoFactory>();
            this.mockFileInfo = new MockFileInfo();

            this.mockFileSystem.SetupGet(x => x.File).Returns(this.mockFile);
            this.mockFileSystem.SetupGet(x => x.FileInfo).Returns(this.mockFileInfoFactory.Object);
            this.mockFileInfoFactory.Setup(x => x.FromFileName(It.IsAny<string>())).Returns(this.mockFileInfo);

            this.mockPluginService.SetupGet(x => x.Messages).Returns(new List<string>());

            this.service = new PluginsService(
                this.mockPluginService.Object,
                this.mockSettingsService.Object,
                this.mockSnippetsService.Object,
                this.mockNugetService.Object);
        }
        public void Initialize()
        {
            this.mockVisualStudioService = new Mock<IVisualStudioService>();
            this.mockFileSystem = new Mock<IFileSystem>();
            this.mockSettingsService = new Mock<ISettingsService>();
            this.mockSnippetsService = new Mock<ISnippetService>();
            this.mockFile = new MockFile();
            this.mockFileInfoFactory = new Mock<IFileInfoFactory>();
            this.mockFileInfo = new MockFileInfo();
            this.mockTranslator = new Mock<ITranslator<string, CodeConfig>>();

            this.mockFileSystem.SetupGet(x => x.File).Returns(this.mockFile);
            this.mockFileSystem.SetupGet(x => x.FileInfo).Returns(this.mockFileInfoFactory.Object);
            this.mockFileInfoFactory.Setup(x => x.FromFileName(It.IsAny<string>())).Returns(this.mockFileInfo);

            this.service = new PluginsService(
                this.mockFileSystem.Object,
                this.mockSettingsService.Object,
                this.mockSnippetsService.Object,
                this.mockTranslator.Object);
        }
        public void TestGetConfigCore()
        {
            MockFile mockFile = new MockFile { FileExists = false };

            this.mockFileSystem.SetupGet(x => x.File).Returns(mockFile);

            ////this.factory.GetConfig("coreDirectory", "fileName");

            ////this.mockTranslator.Verify(x => x.Translate("coreDirectoryfileName"));
        }
        public void TestGetServiceConfig()
        {
            MockFile mockFile = new MockFile();
            this.mockFileSystem.SetupGet(x => x.File).Returns(mockFile);

            SettingsService settingsService = new SettingsService();

            this.mockSettingsService.SetupGet(x => x.ServicesConfigPath).Returns(settingsService.ServicesConfigPath);
            this.mockSettingsService.SetupGet(x => x.UserCodeConfigServicesPath).Returns(settingsService.UserCodeConfigServicesPath);

            this.mockTranslator.Setup(x => x.Translate(It.IsAny<string>())).Returns(new CodeConfig());

            this.factory.GetServiceConfig("friendlyName");

            this.mockTranslator.Verify(x => x.Translate(It.IsAny<string>()));
        }
        public void TestGetPluginConfig()
        {
            Plugin plugin = new Plugin { FriendlyName = "File" };

            MockFile mockFile = new MockFile();
            this.mockFileSystem.SetupGet(x => x.File).Returns(mockFile);

            SettingsService settingsService = new SettingsService();

            this.mockSettingsService.SetupGet(x => x.PluginsConfigPath).Returns(settingsService.PluginsConfigPath);
            this.mockSettingsService.SetupGet(x => x.UserCodeConfigPluginsPath).Returns(settingsService.UserCodeConfigPluginsPath);

            this.mockTranslator.Setup(x => x.Translate(It.IsAny<string>())).Returns(new CodeConfig());

            this.factory.GetPluginConfig(plugin);

            this.mockTranslator.Verify(x => x.Translate(It.IsAny<string>()));
        }