コード例 #1
0
        private static void InitOrReset(IEnumerable <SuppressionManagerInitInfo> suppressionFileInfos,
                                        Func <ISuppressionFileSystemService> fileSystemServiceFabric,
                                        Func <IIOErrorProcessor> errorProcessorFabric,
                                        Func <ICustomBuildActionSetter> buildActionSetterFabric)
        {
            suppressionFileInfos = suppressionFileInfos ?? Enumerable.Empty <SuppressionManagerInitInfo>();

            lock (_initializationLocker)
            {
                if (Instance == null)
                {
                    ISuppressionFileSystemService fileSystemService;

                    if (fileSystemServiceFabric == null)
                    {
                        IIOErrorProcessor errorProcessor = errorProcessorFabric?.Invoke();
                        fileSystemService = new SuppressionFileWithChangesTrackingSystemService(errorProcessor);
                    }
                    else
                    {
                        fileSystemService = fileSystemServiceFabric();
                    }

                    ICustomBuildActionSetter customBuildActionSetter = buildActionSetterFabric?.Invoke();
                    Instance = new SuppressionManager(fileSystemService, customBuildActionSetter);
                }
                else
                {
                    Instance.Clear();
                }

                Instance.LoadSuppressionFiles(suppressionFileInfos);
            }
        }
コード例 #2
0
        private SuppressionManager(ISuppressionFileSystemService fileSystemService, ICustomBuildActionSetter buildActionSetter)
        {
            _fileSystemService      = fileSystemService.CheckIfNull(nameof(fileSystemService));
            _suppressionFileCreator = new SuppressionFileCreator(this);

            BuildActionSetter = buildActionSetter;
        }