コード例 #1
0
 public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
 {
     street_address = RPValidations.Capitalize(street_address, true);
     city           = RPValidations.Capitalize(city, true);
     postal_code    = RPValidations.FormatPostalCode(postal_code);
     yield return(ValidationResult.Success);
 }
コード例 #2
0
 public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
 {
     publisher_name = RPValidations.Capitalize(publisher_name, true);
     contact_name   = RPValidations.Capitalize(contact_name, true);
     contact_phone  = RPValidations.FormatPhoneNumber(contact_phone);
     yield return(ValidationResult.Success);
 }
コード例 #3
0
 public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
 {
     first_name = RPValidations.Capitalize(first_name, true);
     last_name  = RPValidations.Capitalize(last_name, true);
     gender     = RPValidations.Capitalize(gender, false);
     phone      = RPValidations.FormatPhoneNumber(phone);
     yield return(ValidationResult.Success);
 }
コード例 #4
0
 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);
 }
コード例 #5
0
ファイル: UserMetadata.cs プロジェクト: ryanpease/CVGS
 public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
 {
     first_name = RPValidations.Capitalize(first_name, true);
     last_name  = RPValidations.Capitalize(last_name, true);
     gender     = RPValidations.Capitalize(gender, false);
     phone      = RPValidations.FormatPhoneNumber(phone);
     if (date_joined == DateTime.Parse("0001-01-01"))
     {
         date_joined = DateTime.Today;
     }
     yield return(ValidationResult.Success);
 }
コード例 #6
0
 public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
 {
     developer_name = RPValidations.Capitalize(developer_name, true);
     if (!string.IsNullOrWhiteSpace(contact_name))
     {
         contact_name = RPValidations.Capitalize(contact_name, true);
     }
     if (!string.IsNullOrWhiteSpace(contact_phone))
     {
         contact_phone = RPValidations.FormatPhoneNumber(contact_phone);
     }
     yield return(ValidationResult.Success);
 }
コード例 #7
0
        // 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);
        }
コード例 #8
0
        // This test is responsible for checking the Phone Number validation (value including dash delimiters)
        public void PublisherTest_Validation_PhoneNumberWithDashes_ShouldRemoveDashes()
        {
            // Arrange
            Publisher publisher = new Publisher();
            string    phone     = RPValidations.FormatPhoneNumber("000-000-0000");
            string    expected  = "0000000000";

            // Act
            publisher.contact_phone = phone;

            // Assert
            string actual = publisher.contact_phone;

            Assert.AreEqual(expected, actual);
        }
コード例 #9
0
        // This test is responsible for checking the Contact Name validation (value in lowercase characters)
        public void PublisherTest_Validation_ContactNameLowerCase_ShouldCapitalizeFirstLetterOfEachWord()
        {
            // Arrange
            Publisher publisher   = new Publisher();
            string    contactName = RPValidations.Capitalize("frank sinatra", true);
            string    expected    = "Frank Sinatra";

            // Act
            publisher.contact_name = contactName;

            // Assert
            string actual = publisher.contact_name;

            Assert.AreEqual(expected, actual);
        }
コード例 #10
0
ファイル: Store_EventTest.cs プロジェクト: ryanpease/CVGS
        // 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);
        }
コード例 #11
0
ファイル: Store_EventTest.cs プロジェクト: ryanpease/CVGS
        // 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);
        }
コード例 #12
0
        // This test is responsible for checking the Genre Name validation (value in lowercase characters)
        public void GenreTest_Validation_NameLowerCase_ShouldCapitalizeFirstLetters()
        {
            // Arrange
            Genre  genre     = new Genre();
            string genreName = RPValidations.Capitalize("action", true);
            string expected  = "Action";

            // Act
            genre.genre_name = genreName;

            // Assert
            string actual = genre.genre_name;

            Assert.AreEqual(expected, actual);
        }
コード例 #13
0
ファイル: AddressTest.cs プロジェクト: ryanpease/CVGS
        // This test is responsible for checking the Postal Code validation (value in lowercase characters)
        public void AddressTest_Validation_PostalCodeWithLowerCase_ShouldMakeUpperCase()
        {
            // Arrange
            Address address    = new Address();
            string  postalCode = RPValidations.FormatPostalCode("l0l0l0");
            string  expected   = "L0L0L0";

            // Act
            address.postal_code = postalCode;

            // Assert
            string actual = address.postal_code;

            Assert.AreEqual(expected, actual);
        }
コード例 #14
0
        // 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);
        }
コード例 #15
0
        // 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);
        }
コード例 #16
0
        // 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);
        }
コード例 #17
0
        // This test is responsible for checking the Game Name validation (value in lowercase characters)
        public void GameTest_Validation_NameLowerCase_ShouldCapitalizeFirstLetters()
        {
            // Arrange
            Game   game     = new Game();
            string gameName = RPValidations.Capitalize("the legend of zelda", true);
            string expected = "The Legend Of Zelda";

            // Act
            game.game_name = gameName;

            // Assert
            string actual = game.game_name;

            Assert.AreEqual(expected, actual);
        }
コード例 #18
0
        // 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);
        }
コード例 #19
0
ファイル: Store_EventTest.cs プロジェクト: ryanpease/CVGS
        // This test is responsible for checking the Store Event Name validation (value in lowercase characters)
        public void Store_EventTest_Validation_NameLowerCase_ShouldCapitalizeFirstLetters()
        {
            // Arrange
            Store_Event storeEvent = new Store_Event();
            string      eventName  = RPValidations.Capitalize("best sale ever", true);
            string      expected   = "Best Sale Ever";

            // Act
            storeEvent.store_event_name = eventName;

            // Assert
            string actual = storeEvent.store_event_name;

            Assert.AreEqual(expected, actual);
        }
コード例 #20
0
        // 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);
        }
コード例 #21
0
        // This test is responsible for checking the Last Name validation (value in lowercase characters)
        public void UserTest_Validation_LastNameLowerCase_ShouldCapitalizeFirstLetter()
        {
            // Arrange
            User   user     = new User();
            string lastName = RPValidations.Capitalize("jenkins", false);
            string expected = "Jenkins";

            // Act
            user.last_name = lastName;

            // Assert
            string actual = user.last_name;

            Assert.AreEqual(expected, actual);
        }
コード例 #22
0
ファイル: DeveloperTest.cs プロジェクト: ryanpease/CVGS
        // This test is responsible for checking the Contact Name validation (value in lowercase characters)
        public void DeveloperTest_Validation_ContactNameLowerCase_ShouldCapitalizeFirstLetterOfEachWord()
        {
            // Arrange
            Developer developer   = new Developer();
            string    contactName = RPValidations.Capitalize("homer simpson", true);
            string    expected    = "Homer Simpson";

            // Act
            developer.contact_name = contactName;

            // Assert
            string actual = developer.contact_name;

            Assert.AreEqual(expected, actual);
        }
コード例 #23
0
ファイル: AddressTest.cs プロジェクト: ryanpease/CVGS
        // This test is responsible for checking the Street Address validation (value in lowercase characters)
        public void AddressTest_Validation_AddressWithLowerCase_ShouldMakeFirstLetterOfEachWord()
        {
            // Arrange
            Address address  = new Address();
            string  address1 = RPValidations.Capitalize("202 hello hello st", true);
            string  expected = "202 Hello Hello St";

            // Act
            address.street_address = address1;

            // Assert
            string actual = address.street_address;

            Assert.AreEqual(expected, actual);
        }
コード例 #24
0
ファイル: Store_EventTest.cs プロジェクト: ryanpease/CVGS
        // 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);
        }
コード例 #25
0
        // This test is responsible for checking the First Name validation (value in lowercase characters)
        public void UserTest_Validation_FirstNameLowerCase_ShouldCapitalizeFirstLetter()
        {
            // Arrange
            User   user      = new User();
            string firstName = RPValidations.Capitalize("leroy", false);
            string expected  = "Leroy";

            // Act
            user.first_name = firstName;

            // Assert
            string actual = user.first_name;

            Assert.AreEqual(expected, actual);
        }
コード例 #26
0
 public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
 {
     game_name   = RPValidations.Capitalize(game_name, true);
     description = RPValidations.CapitalizeSentences(description);
     yield return(ValidationResult.Success);
 }