public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { genre_name = RPValidations.Capitalize(genre_name, true); if (!String.IsNullOrWhiteSpace(description)) { description = RPValidations.CapitalizeSentences(description); } yield return(ValidationResult.Success); }
// This test is responsible for checking the Description validation (value in lowercase characters) public void GameTest_Validation_DescriptionUpperCase_ShouldCapitalizeFirstLetterOfEachSentence() { // Arrange Genre genre = new Genre(); string description = RPValidations.CapitalizeSentences("A GENRE CHARACTERIZED BY ACTION. THIS GENRE IS OFTEN DOMINATED BY MOVIE SPINOFF GAMES."); string expected = "A genre characterized by action. This genre is often dominated by movie spinoff games."; // Act genre.description = description; // Assert string actual = genre.description; Assert.AreEqual(expected, actual); }
// This test is responsible for checking the Description validation on sentences containing a single word (value in uppercase characters) public void GenreTest_Validation_DescriptionUpperCase_ShouldCapitalizeFirstLetterOfEachSentenceEvenSingleWordSentences() { // Arrange Genre genre = new Genre(); string description = RPValidations.CapitalizeSentences("ACTION. ACTION AND ADVENTURE. PLATFORM."); string expected = "Action. Action and adventure. Platform."; // Act genre.description = description; // Assert string actual = genre.description; Assert.AreEqual(expected, actual); }
// This test is responsible for checking the Description validation on sentences containing a single word (value in uppercase characters) public void Store_EventTest_Validation_DescriptionUpperCase_ShouldCapitalizeFirstLetterOfEachSentenceEvenSingleWordSentences() { // Arrange Store_Event storeEvent = new Store_Event(); string description = RPValidations.CapitalizeSentences("BIGGEST. BIGGEST SALE. EVER"); string expected = "Biggest. Biggest sale. Ever."; // Act storeEvent.description = description; // Assert string actual = storeEvent.description; Assert.AreEqual(expected, actual); }
// This test is responsible for checking the Description validation (value in lowercase characters) public void GameTest_Validation_DescriptionLowerCase_ShouldCapitalizeFirstLetterOfEachSentence() { // Arrange Genre genre = new Genre(); string description = RPValidations.CapitalizeSentences("a genre characterized by action. this genre is often dominated by movie spinoff games."); string expected = "A genre characterized by action. This genre is often dominated by movie spinoff games."; // Act genre.description = description; // Assert string actual = genre.description; Assert.AreEqual(expected, actual); }
// This test is responsible for checking the Description validation (value in uppercase characters) public void Store_EventTest_Validation_DescriptionUpperCase_ShouldCapitalizeFirstLetterOfEachSentence() { // Arrange Store_Event storeEvent = new Store_Event(); string description = RPValidations.CapitalizeSentences("A SALE FOR ALL OF OUR CUSTOMERS. IT'S OUR CHANCE TO PAY YOU BACK FOR YOUR LOYALTY."); string expected = "A sale for all of our customers. It's our chance to pay you back for your loyalty."; // Act storeEvent.description = description; // Assert string actual = storeEvent.description; Assert.AreEqual(expected, actual); }
// This test is responsible for checking the Description validation (value in lowercase characters) public void Store_EventTest_Validation_DescriptionLowerCase_ShouldCapitalizeFirstLetterOfEachSentence() { // Arrange Store_Event storeEvent = new Store_Event(); string description = RPValidations.CapitalizeSentences("a sale for all of our customers. it's our chance to pay you back for your loyalty."); string expected = "A sale for all of our customers. It's our chance to pay you back for your loyalty."; // Act storeEvent.description = description; // Assert string actual = storeEvent.description; Assert.AreEqual(expected, actual); }
// This test is responsible for checking the Description validation on sentences containing a single word (value in uppercase characters) public void GameTest_Validation_DescriptionUpperCase_ShouldCapitalizeFirstLetterOfEachSentenceEvenSingleWordSentences() { // Arrange Game game = new Game(); string description = RPValidations.CapitalizeSentences("SOMETHING. SOMETHING ZELDA. ZELDA."); string expected = "Something. Something zelda. Zelda."; // Act game.description = description; // Assert string actual = game.description; Assert.AreEqual(expected, actual); }
// This test is responsible for checking the Description validation (value in uppercase characters) public void GameTest_Validation_DescriptionUpperCase_ShouldCapitalizeFirstLetterOfEachSentence() { // Arrange Game game = new Game(); string description = RPValidations.CapitalizeSentences("A GAME ABOUT A MYSTERIOUS ADVENTURER WHO WEARS GREEN. HE'S ON A MISSION TO SAVE PRINCESS ZELDA."); string expected = "A game about a mysterious adventurer who wears green. He's on a mission to save princess zelda."; // Act game.description = description; // Assert string actual = game.description; Assert.AreEqual(expected, actual); }
// This test is responsible for checking the Description validation (value in lowercase characters) public void GameTest_Validation_DescriptionLowerCase_ShouldCapitalizeFirstLetterOfEachSentence() { // Arrange Game game = new Game(); string description = RPValidations.CapitalizeSentences("a game about a mysterious adventurer who wears green. he's on a mission to save princess zelda."); string expected = "A game about a mysterious adventurer who wears green. He's on a mission to save princess zelda."; // Act game.description = description; // Assert string actual = game.description; Assert.AreEqual(expected, actual); }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { game_name = RPValidations.Capitalize(game_name, true); description = RPValidations.CapitalizeSentences(description); yield return(ValidationResult.Success); }