diff --git a/src/Core.UnitTests/SystemAbstractions/FileSystemServiceTests.cs b/src/Core.UnitTests/SystemAbstractions/FileSystemServiceTests.cs new file mode 100644 index 0000000000..a85da5c774 --- /dev/null +++ b/src/Core.UnitTests/SystemAbstractions/FileSystemServiceTests.cs @@ -0,0 +1,34 @@ +/* + * SonarLint for Visual Studio + * Copyright (C) 2016-2024 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +using SonarLint.VisualStudio.Core.SystemAbstractions; +using SonarLint.VisualStudio.TestInfrastructure; + +namespace SonarLint.VisualStudio.Core.UnitTests.SystemAbstractions; + +[TestClass] +public class FileSystemServiceTests +{ + [TestMethod] + public void MefCtor_CheckIsExported() => MefTestHelpers.CheckTypeCanBeImported(); + + [TestMethod] + public void MefCtor_CheckIsSingleton() => MefTestHelpers.CheckIsSingletonMefComponent(); +} diff --git a/src/Core/SystemAbstractions/IFileSystemService.cs b/src/Core/SystemAbstractions/IFileSystemService.cs new file mode 100644 index 0000000000..993783a567 --- /dev/null +++ b/src/Core/SystemAbstractions/IFileSystemService.cs @@ -0,0 +1,30 @@ +/* + * SonarLint for Visual Studio + * Copyright (C) 2016-2024 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +using System.ComponentModel.Composition; +using System.IO.Abstractions; + +namespace SonarLint.VisualStudio.Core.SystemAbstractions; + +public interface IFileSystemService : IFileSystem; // separate export interface to avoid conflicts + +[Export(typeof(IFileSystemService))] +[PartCreationPolicy(CreationPolicy.Shared)] +public sealed class FileSystemService : FileSystem, IFileSystemService; // exporting class