public void TestInspectString_CustomDictionary() { string testData = "My name is Robert and my phone number is (425) 634-9233."; var infoTypes = new InfoType[] { }; var customDictionary = new CustomInfoType[] { new CustomInfoType { InfoType = new InfoType { Name = $"CUSTOM_DICTIONARY_{Guid.NewGuid()}" }, Dictionary = new CustomInfoType.Types.Dictionary { WordList = new CustomInfoType.Types.Dictionary.Types.WordList { Words = { new string[] { "Robert" } } } } } }; var response = InspectString.Inspect(Fixture.ProjectId, testData, Likelihood.Possible.ToString(), 5, true, infoTypes, customDictionary); Assert.Contains(response.Result.Findings, f => f.Quote == "Robert"); }
public void TestInspectString_CustomInfoType_NoResults() { string testData = "She sells sea shells by the sea shore."; var infoTypes = new InfoType[] { }; var customInfoType = new CustomInfoType[] { new CustomInfoType { InfoType = new InfoType { Name = $"CUSTOM_REGEX_{Guid.NewGuid()}" }, Regex = new CustomInfoType.Types.Regex { Pattern = "\\(\\d{3}\\) \\d{3}-\\d{4}" }, Dictionary = new CustomInfoType.Types.Dictionary { WordList = new CustomInfoType.Types.Dictionary.Types.WordList { Words = { new string[] { "Robert" } } } } } }; var response = InspectString.Inspect(Fixture.ProjectId, testData, Likelihood.Possible.ToString(), 5, true, infoTypes, customInfoType); Assert.True(!response.Result.Findings.Any()); }
public void TestInspectString_NoResults() { string testData = "She sells sea shells by the sea shore."; var infoTypes = new InfoType[] { new InfoType { Name = "PERSON_NAME" } }; var customInfoTypes = new CustomInfoType[] { }; var response = InspectString.Inspect(Fixture.ProjectId, testData, Likelihood.Possible.ToString(), 5, true, infoTypes, customInfoTypes); Assert.True(!response.Result.Findings.Any()); }
public void TestInspectString_PersonName() { string testData = "The name Robert is very common."; var infoTypes = new InfoType[] { new InfoType { Name = "PERSON_NAME" } }; var customInfoTypes = new CustomInfoType[] { }; var response = InspectString.Inspect(Fixture.ProjectId, testData, Likelihood.Possible.ToString(), 5, true, infoTypes, customInfoTypes); Assert.Contains(response.Result.Findings, f => f.Quote == "Robert"); }
public void TestInspectString_CustomRegex() { string testData = "My name is Robert and my phone number is (425) 634-9233."; var infoTypes = new InfoType[] { }; var customRegex = new CustomInfoType[] { new CustomInfoType { InfoType = new InfoType { Name = $"CUSTOM_REGEX_{Guid.NewGuid()}" }, Regex = new CustomInfoType.Types.Regex { Pattern = "\\(\\d{3}\\) \\d{3}-\\d{4}" } } }; var response = InspectString.Inspect(Fixture.ProjectId, testData, Likelihood.Possible.ToString(), 5, true, infoTypes, customRegex); Assert.Contains(response.Result.Findings, f => f.Quote == "(425) 634-9233"); }