public void ToListReturnsReadOnlyCollectionContainingAllowListAfterListModification() { var allowList = new AllowList(); allowList.Add("Scunthorpe"); allowList.Add("Penistone"); var readonlyList = allowList.ToList; Assert.IsNotNull(readonlyList); Assert.AreEqual(2, readonlyList.Count); Assert.AreEqual("scunthorpe", readonlyList[0]); Assert.AreEqual("penistone", readonlyList[1]); allowList.Add("Bugger"); allowList.Add("Plonker"); readonlyList = allowList.ToList; Assert.IsNotNull(readonlyList); Assert.AreEqual(4, readonlyList.Count); Assert.AreEqual("scunthorpe", readonlyList[0]); Assert.AreEqual("penistone", readonlyList[1]); Assert.AreEqual("bugger", readonlyList[2]); Assert.AreEqual("plonker", readonlyList[3]); }
public void CountReturnsTwoForTwoEntriesInTheList() { var allowList = new AllowList(); allowList.Add("Scunthorpe"); allowList.Add("Penistone"); Assert.AreEqual(2, allowList.Count); }
public void ContainsReturnsFalseForAllowListItemNotInTheList() { var allowList = new AllowList(); allowList.Add("Scunthorpe"); allowList.Add("Penistone"); Assert.IsFalse(allowList.Contains("Wibble")); Assert.IsFalse(allowList.Contains("Gobble")); }
public void ContainsReturnsTrueForAllowListItemInTheListWithMixedCase() { var allowList = new AllowList(); allowList.Add("Scunthorpe"); allowList.Add("Penistone"); Assert.IsTrue(allowList.Contains("ScunThorpe")); Assert.IsTrue(allowList.Contains("PeniStone")); }
public void RemoveNonExistingEntryFromTheAllowListReturnsFalse() { var allowList = new AllowList(); allowList.Add("Scunthorpe"); allowList.Add("Penistone"); Assert.AreEqual(2, allowList.Count); Assert.IsFalse(allowList.Remove("DoesNotExist")); }
public void RemoveEntryFromTheAllowListReturnsTrue() { var allowList = new AllowList(); allowList.Add("Scunthorpe"); allowList.Add("Penistone"); Assert.AreEqual(2, allowList.Count); Assert.IsTrue(allowList.Remove("Scunthorpe")); }
public void ClearRemovesEntriesFromTheList() { var allowList = new AllowList(); allowList.Add("Scunthorpe"); allowList.Add("Penistone"); Assert.AreEqual(2, allowList.Count); allowList.Clear(); Assert.AreEqual(0, allowList.Count); }
public void AddDoesntAllowDuplicateEntries() { var allowList = new AllowList(); Assert.AreEqual(0, allowList.Count); allowList.Add("Scunthorpe"); Assert.AreEqual(1, allowList.Count); allowList.Add("Scunthorpe"); Assert.AreEqual(1, allowList.Count); }
public void ToListReturnsReadOnlyCollectionContainingAllowList() { var allowList = new AllowList(); allowList.Add("Scunthorpe"); allowList.Add("Penistone"); var readonlyList = allowList.ToList; Assert.IsNotNull(readonlyList); Assert.AreEqual(2, readonlyList.Count); Assert.AreEqual("scunthorpe", readonlyList[0]); Assert.AreEqual("penistone", readonlyList[1]); }
public void RemoveMixedCaseEntryFromTheAllowList() { var allowList = new AllowList(); allowList.Add("Scunthorpe"); allowList.Add("Penistone"); Assert.AreEqual(2, allowList.Count); allowList.Remove("ScUnThOrPe"); Assert.AreEqual(1, allowList.Count); Assert.IsFalse(allowList.Contains("Scunthorpe")); Assert.IsTrue(allowList.Contains("Penistone")); }
public async Task <IAdGuardListService> FromFileAsync(Stream stream, FileProviderFormat inputFormat, FileProviderType inputType, string comment = "") { int currentElementInLists = AllowList.Count + BlockList.Count; using var fileStream = new StreamReader(stream); string currentLine; while ((currentLine = await fileStream.ReadLineAsync()) != null) { currentLine = FileLineTransform(currentLine, inputFormat, inputType); if (string.IsNullOrWhiteSpace(currentLine)) { continue; } switch (inputType) { case FileProviderType.ALLOW_LIST: AllowList.Add(currentLine + comment); break; case FileProviderType.BLOCK_LIST: BlockList.Add(currentLine + comment); break; } } _logger.LogInformation($"{AllowList.Count + BlockList.Count - currentElementInLists} element(s) added with file"); return(this); }
public void AddInsertsLowercaseItemIntoTheAllowList() { var allowList = new AllowList(); allowList.Add("Scunthorpe"); Assert.IsTrue(allowList.Contains("scunthorpe")); }
internal void MoveToAllowListFromDenyList(List <string> targetList) { foreach (var target in targetList) { AllowList.Add(target); } DeleteRowFromDenyList(targetList); }
public void AddInsertsItemIntoTheAllowList() { var allowList = new AllowList(); Assert.AreEqual(0, allowList.Count); allowList.Add("Scunthorpe"); Assert.AreEqual(1, allowList.Count); }
public void AddThrowsArgumentNullExceptionIfInputStringIsNullOrEmpty() { var allowList = new AllowList(); allowList.Add(""); }
internal void AddAllowList(string domain) { AllowList.Add(domain); }