public async Task Should_Provide_The_Merged_Result_Using_FCC_Settings_Files()
        {
            var mockCoverageProject = new Mock <ICoverageProject>();

            mockCoverageProject.Setup(cp => cp.ProjectFile).Returns("SomeProject/SomeProject.csproj");

            var mockFCCSettingsFilesProvider = new Mock <IFCCSettingsFilesProvider>();
            var settingsFileElements         = new List <XElement>();

            mockFCCSettingsFilesProvider.Setup(
                fccSettingsFilesProvider => fccSettingsFilesProvider.Provide("SomeProject")
                ).Returns(settingsFileElements);

            var mockSettingsMerger = new Mock <ISettingsMerger>();
            var mergedSettings     = new Mock <IAppOptions>().Object;

            mockSettingsMerger.Setup(settingsMerger =>
                                     settingsMerger.Merge(It.IsAny <IAppOptions>(), settingsFileElements, It.IsAny <XElement>())
                                     ).Returns(mergedSettings);

            var coverageProjectSettingsManager = new CoverageProjectSettingsManager(
                new Mock <IAppOptionsProvider>().Object,
                new Mock <ICoverageProjectSettingsProvider>().Object,
                mockFCCSettingsFilesProvider.Object,
                mockSettingsMerger.Object
                );


            var coverageProject         = mockCoverageProject.Object;
            var coverageProjectSettings = await coverageProjectSettingsManager.GetSettingsAsync(coverageProject);

            Assert.AreSame(mergedSettings, coverageProjectSettings);
        }
        public async Task Should_Provide_The_Merged_Result_Using_Project_Settings()
        {
            var coverageProject = new Mock <ICoverageProject>().Object;

            var coverageProjectSettingsElement      = new XElement("Root");
            var mockCoverageProjectSettingsProvider = new Mock <ICoverageProjectSettingsProvider>();

            mockCoverageProjectSettingsProvider.Setup(
                coverageProjectSettingsProvider => coverageProjectSettingsProvider.ProvideAsync(coverageProject)
                ).ReturnsAsync(coverageProjectSettingsElement);

            var mockSettingsMerger = new Mock <ISettingsMerger>();
            var mergedSettings     = new Mock <IAppOptions>().Object;

            mockSettingsMerger.Setup(settingsMerger =>
                                     settingsMerger.Merge(It.IsAny <IAppOptions>(), It.IsAny <List <XElement> >(), coverageProjectSettingsElement)
                                     ).Returns(mergedSettings);

            var coverageProjectSettingsManager = new CoverageProjectSettingsManager(
                new Mock <IAppOptionsProvider>().Object,
                mockCoverageProjectSettingsProvider.Object,
                new Mock <IFCCSettingsFilesProvider>().Object,
                mockSettingsMerger.Object
                );



            var coverageProjectSettings = await coverageProjectSettingsManager.GetSettingsAsync(coverageProject);

            Assert.AreSame(mergedSettings, coverageProjectSettings);
        }
        public async Task Should_Provide_The_Merged_Result_Using_Global_Options()
        {
            var mockAppOptionsProvider = new Mock <IAppOptionsProvider>();
            var mockAppOptions         = new Mock <IAppOptions>();
            var globalOptions          = mockAppOptions.Object;

            mockAppOptionsProvider.Setup(appOptionsProvider => appOptionsProvider.Get()).Returns(globalOptions);

            var mockSettingsMerger = new Mock <ISettingsMerger>();
            var mergedSettings     = new Mock <IAppOptions>().Object;

            mockSettingsMerger.Setup(settingsMerger =>
                                     settingsMerger.Merge(globalOptions, It.IsAny <List <XElement> >(), It.IsAny <XElement>())
                                     ).Returns(mergedSettings);

            var coverageProjectSettingsManager = new CoverageProjectSettingsManager(
                mockAppOptionsProvider.Object,
                new Mock <ICoverageProjectSettingsProvider>().Object,
                new Mock <IFCCSettingsFilesProvider>().Object,
                mockSettingsMerger.Object
                );

            var coverageProjectSettings = await coverageProjectSettingsManager.GetSettingsAsync(
                new Mock <ICoverageProject>().Object
                );

            Assert.AreSame(mergedSettings, coverageProjectSettings);
        }