public IList <MutationDocumentFilterItem> CreateGitFilterItems(string solutionPath, GitInfo gitInfo, CancellationToken cancellationToken = default(CancellationToken)) { cancellationToken.ThrowIfCancellationRequested(); var filterItems = new List <MutationDocumentFilterItem>(); if (gitInfo != null && gitInfo.GenerateFilterFromDiffWithMaster) { Log.Info("Creating filter items from git diff with master"); filterItems.AddRange(_diffCreator.GetFilterItemsFromDiff(Path.GetDirectoryName(solutionPath))); } return(filterItems); }
public void GetFilterItemsFromDiff_WhenGettingFilterFromDiff_ShouldGetFIlter() { var filter = _mutationDocumentFilterItemGitDiffCreator.GetFilterItemsFromDiff("SomePath"); Assert.AreEqual(2, filter.Count, "Wrong filter count"); var filterItem = filter[1]; Assert.AreEqual("*src/Testura.Mutation.Application/Commands/Project/OpenProject/Handlers/OpenProjectMutatorsHandler.cs", filterItem.Resource, "Wrong resource"); Assert.AreEqual(MutationDocumentFilterItem.FilterEffect.Allow, filterItem.Effect, "Wrong effect"); Assert.AreEqual(11, filterItem.Lines.Count, "Wrong filter item lines count"); Assert.AreEqual("27,2", filterItem.Lines[5], "Wrong for multi line"); Assert.AreEqual("25", filterItem.Lines[4], "Wrong for single line"); }