public void AmbiguousButton() { AmbiguousNameForm form = new AmbiguousNameForm(); form.Show(); Censor.Add("NunitFormsTestApplicationsCustomTesters"); TestWriter writer = new TestWriter(form); Assert.AreEqual("", writer.Test); ButtonTester button = new ButtonTester("myControl2.myButton", form); button.Click(); Assert.AreEqual( @"[Test] public void Test() { ButtonTester myControl2_myButton = new ButtonTester(""myControl2.myButton""); myControl2_myButton.Click(); }", writer.Test); Censor.Remove("NunitFormsTestApplicationsCustomTesters"); }
public Censor Create(Censor newObject) { _context.Censors.Add(newObject); _context.SaveChanges(); return(_context.Censors.Last()); }
public static Shape createShape(ScreenshotEditor editor, bool cropBoxActive, XPathNavigator element) { string type = element.GetAttribute("type", ""); Shape s = null; switch (type) { case "Arrow": s = new Arrow(editor, element); break; case "CropBox": s = new CropBox(editor, element, cropBoxActive); break; case "Censor": s = new Censor(editor, element); break; case "Line": s = new Line(editor, element); break; case "Oval": s = new Oval(editor, element); break; case "MagnifyingGlass": s = new MagnifyingGlass(editor, element); break; case "Pencil": s = new Pencil(editor, element); break; case "Picture": s = new Picture(editor, element); break; case "PonyVille": s = new PonyVille(editor, element); break; case "RectangleShape": s = new RectangleShape(editor, element); break; case "TextShape": s = new TextShape(editor, element); break; default: break; } return(s); }
public void Delete(int id) { Censor x = _context.Censors.Find(id); if (x != null) { _context.Censors.Remove(x); _context.SaveChanges(); } }
public void DirtyWordsWithSpaces() { var test = "The dirty word hello world and Hello World"; var censor = new Censor(new [] { "hello world" }); var correct = "The dirty word *********** and ***********"; var result = censor.CensorText(test); Assert.IsTrue(censor.HasCensoredWord(test), "The text is dirty, but returned false"); Assert.AreEqual(result, correct, "All words were not filtered"); }
public void NoDirtyWords() { var censor = new Censor(new [] { "helloworld" }); var test = "The dirty word is not here"; var correct = "The dirty word is not here"; var result = censor.CensorText(test); Assert.IsFalse(censor.HasCensoredWord(test), "The text is not dirty, but returned true"); Assert.AreEqual(result, correct, "All words were not censored correctly"); }
public void NoDirtyWords() { var censor = new Censor(new []{"helloworld"}); var test = "The dirty word is not here"; var correct = "The dirty word is not here"; var result = censor.CensorText(test); Assert.IsFalse(censor.HasCensoredWord(test), "The text is not dirty, but returned true"); Assert.AreEqual(result, correct, "All words were not censored correctly"); }
public void DirtyWordsWithSpaces() { var test = "The dirty word hello world and Hello World"; var censor = new Censor(new []{"hello world"}); var correct = "The dirty word *********** and ***********"; var result = censor.CensorText(test); Assert.IsTrue(censor.HasCensoredWord(test), "The text is dirty, but returned false"); Assert.AreEqual(result, correct, "All words were not filtered"); }
public void censorPalindromesTest_NoPalindromes() { Censor censor = new Censor(); string inputText = "she went to vote in the election to fulfil her duty"; string expectedOutput = "she went to vote in the election to fulfil her duty"; string actualOutput = censor.censorPalindromes(inputText); Assert.AreEqual(expectedOutput, actualOutput); }
public void censorPalindromesTest_EmptyString() { Censor censor = new Censor(); string inputText = " "; string expectedOutput = " "; string actualOutput = censor.censorPalindromes(inputText); Assert.AreEqual(expectedOutput, actualOutput); }
public string AutomaticReviewEditor(string originalDescription) { var censoredWords = this.context.CensoredWords .Select(x => x.Word) .ToList(); var censor = new Censor(censoredWords); var editDescription = censor.CensorText(originalDescription); return(editDescription); }
public InfoModule(CommandService service, GoogleSearchService searchService, IConfigService config) { commandService = service; var censoredWords = config.GetValue <IEnumerable <string> >("CensoredWords"); censor = new Censor(censoredWords); halfDaySchedule = config.GetValue <SchoolSchedule>("HalfDaySchedule").ToString(); fullDaySchedule = config.GetValue <SchoolSchedule>("FullDaySchedule").ToString(); this.searchService = searchService; }
public void censorWordsTest_EmptyList() { Censor censor = new Censor(); List <string> inputCensoredList = new List <string> { }; string inputText = "I have a cat named Meow and a dog named Woof. I love the dog a lot. He is larger than a small horse."; string expectedOutput = "I have a cat named Meow and a dog named Woof. I love the dog a lot. He is larger than a small horse."; string actualOutput = censor.censorWordsinSentence(inputCensoredList, inputText); Assert.AreEqual(expectedOutput, actualOutput); }
public Censor Update(Censor updatedObject) { Censor x = _context.Censors.Find(updatedObject.ID); if (x == null) { throw new AppException("Censor not found"); } /*copy properties here*/ _context.Censors.Update(x); _context.SaveChanges(); return(x); }
public IActionResult Create([FromBody] CensorDto censorDto) { // map dto to entity and set id Censor c = _mapper.Map <Censor>(censorDto); try { // save c = _censorService.Create(c); return(Ok(_mapper.Map <CensorDto>(c))); } catch (AppException ex) { // return error message if there was an exception return(BadRequest(ex.Message)); } }
public async Task <IActionResult> AddQuestion(NewQuestionModel model) { var userId = _userManager.GetUserId(User); var user = _userManager.FindByIdAsync(userId).Result; var question = BuildPost(model, user); string[] censoredWords = System.IO.File.ReadAllLines(@"CensoredWords.txt"); Censor censor = new Censor(censoredWords); question.QuestionTitle = censor.CensorText(question.QuestionTitle); question.QuestionContent = censor.CensorText(question.QuestionContent); await _questionImplementation.AddQuestion(question); await _applicationUserImplementation.UpdateUserRating(userId, typeof(Question)); return(RedirectToAction("Index", "Question", new { id = question.QuestionId })); }
public async Task <IActionResult> AddAnswer(QuestionIndexModel model) { var userId = _userManager.GetUserId(User); var user = await _userManager.FindByIdAsync(userId); var answer = BuildReply(model, user); string[] censoredWords = System.IO.File.ReadAllLines(@"CensoredWords.txt"); Censor censor = new Censor(censoredWords); answer.AnswerContent = censor.CensorText(answer.AnswerContent); await _questionImplementation.AddAnswer(answer); await _applicationUserImplementation.UpdateUserRating(userId, typeof(Answer)); return(RedirectToAction("Index", "Question", new { id = model.QuestionId })); }
public async Task <IActionResult> AddStatus(AddStatusModel model, StatusCategoryListingModel dol) { var userId = _userManager.GetUserId(User); var user = _userManager.FindByIdAsync(userId).Result; var status = BuildPost(model, user, dol); string[] censoredWords = System.IO.File.ReadAllLines(@"CensoredWords.txt"); Censor censor = new Censor(censoredWords); status.StatusTitle = censor.CensorText(status.StatusTitle); await _statusImplementation.AddStatus(status); await _applicationUserImplementation.UpdateUserRating(userId, typeof(Status)); return(RedirectToAction("Index", "Status", new { id = status.StatusId })); }
[Test]//Original from post public void WildcardDirty() { var censor = new Censor(new [] { "gosh", "drat", "darn*", }); string result; result = censor.CensorText("I stubbed my toe. Gosh it hurts!"); Assert.AreEqual(result, "I stubbed my toe. **** it hurts!"); result = censor.CensorText("The midrate on the USD -> EUR forex trade has soured my day. Drat!"); Assert.AreEqual(result, "The midrate on the USD -> EUR forex trade has soured my day. ****!"); result = censor.CensorText("Gosh darnit, my shoe laces are undone."); Assert.AreEqual(result, "**** ******, my shoe laces are undone."); }
public object Post(Censor model) { using (var context = DataContext.Create()) { var censor = context.Censors.Find(model.Id); if (censor != null) { censor.Word = model.Word; } else { censor = new Censor() { Word = model.Word }; } context.Censors.AddOrUpdate(censor); context.SaveChanges(); return(Ok(censor)); } }
void Awake() { self = this; }
public TweetController() { censor = new Censor(words.Split(new[] { ',' })); cache = new MemoryCacher(); }
private void Start() { audioManager = GetComponent <AudioManager>(); speechCoroutine = StartCoroutine(Speech()); censor = GetComponent <Censor>(); }
void Start() { censor = GetComponent <Censor> (); }
public string CrapCensor(string censorSomeWords) { var censoredWords = new List <string> { "gosh", "drat", "darn*", "f**k", "anal", "anus", "arse", "ass", "ballsack", "balls", "bastard", "bitch", "biatch", "bloody", "b*****b", "blow job", "bollock", "bollok", "boner", "boob", "bugger", "bum", "butt", "b******g", "clitoris", "c**k", "coon", "crap", "c**t", "damn", "dick", "d***o", "dyke", "f*g", "feck", "f*****e", "f******o", "f******g", "f**k", "f u c k", "f*********r", "fudge packer", "flange", "Goddamn", "God damn", "hell", "h**o", "jerk", "j**z", "k*****d", "knob end", "labia", "lmfao", "muff", "nigger", "n***a", "omg", "penis", "piss", "poop", "prick", "pube", "pussy", "queer", "scrotum", "sex", "shit", "s hit", "sh1t", "s**t", "s****a", "spunk", "tit", "t**s", "tosser", "turd", "twat", "v****a", "wank", "w***e", "wtf", "ji bai", "jibai", "na bei", "cb", "ccb", "kns", "mf", "m**********r", "stupid", "f****t" }; var censor = new Censor(censoredWords); string result; result = censor.CensorText(censorSomeWords); return(result); }
public TweetsService() { censor = new Censor(words.Split(new[] { ',' })); }
public static int Main(string[] args) { Console.WriteLine("Hello World!"); var path = args[0]; var censoredWords = args[1]; if (string.IsNullOrWhiteSpace(path)) { Console.WriteLine($"Wrong path was send as argument."); return(-1); } if (string.IsNullOrWhiteSpace(censoredWords)) { Console.WriteLine("No censored words were given"); return(-1); } var directoryInfo = new DirectoryInfo(path); if (!directoryInfo.Exists) { return(-1); } var censorResults = new List <CensoredResult>(); var censor = new Censor(censoredWords.Split(",")); foreach (var file in directoryInfo.EnumerateFiles("*.md", SearchOption.AllDirectories)) { try { using (var stream = file.OpenText()) { int lineNumber = 0; string line; while ((line = stream.ReadLine()) != null) { lineNumber++; if (censor.HasCensoredWord(line)) { var censoredResult = new CensoredResult(); censoredResult.FileName = file.FullName; censoredResult.LineNumber = lineNumber; censoredResult.CensoredLine = censor.CensorText(line); censorResults.Add(censoredResult); } } } } catch { continue; } } if (censorResults.Count > 0) { Console.WriteLine($"{censorResults.Count} Censors found"); var jsonString = JsonConvert.SerializeObject(censorResults, Formatting.Indented); Console.WriteLine(jsonString); return(-1); } return(0); }