예제 #1
0
        public void CleanAddresses_TwoMessyAddressesSentIn_SameNumberOfCleanAddessesReturned()
        {
            // Arrange
            var messyAddresses = new List <MessyAddressInformation>();

            messyAddresses.Add(new MessyAddressInformation());
            messyAddresses.Add(new MessyAddressInformation());

            // Act
            var classToTest = new MessyListToCleanList();
            var result      = classToTest.CleanAddresses(messyAddresses);

            // Assert
            result.Count.ShouldBe(2);
        }
예제 #2
0
        public void CleanAddresses_MessyAddressHasNameWithOnlyFirstName_FirstNameHasSentInValue()
        {
            // Arrange
            var name = "Matthew";

            var messyAddresses = new List <MessyAddressInformation>();

            messyAddresses.Add(new MessyAddressInformation {
                Name = name
            });

            // Act
            var classToTest = new MessyListToCleanList();
            var result      = classToTest.CleanAddresses(messyAddresses);

            // Assert
            result.Any(x => x.FirstName == "Matthew").ShouldBe(true);
        }
예제 #3
0
        public void CleanAddresses_MessyAddressHasName_SplitsNameOnSpacesAndStoresCorrentValueIntoLastName()
        {
            // Arrange
            var name = "Matthew Puneky";

            var messyAddresses = new List <MessyAddressInformation>();

            messyAddresses.Add(new MessyAddressInformation {
                Name = name
            });

            // Act
            var classToTest = new MessyListToCleanList();
            var result      = classToTest.CleanAddresses(messyAddresses);

            // Assert
            result.Any(x => x.LastName == "Puneky").ShouldBe(true);
        }
예제 #4
0
        public void CleanAddresses_MessyAddressHasAddressOfNothing_ZipCodeHasValueOfNA()
        {
            // Arrange
            var address = "";

            var messyAddresses = new List <MessyAddressInformation>();

            messyAddresses.Add(new MessyAddressInformation {
                Address = address
            });

            // Act
            var classToTest = new MessyListToCleanList();
            var result      = classToTest.CleanAddresses(messyAddresses);

            // Assert
            result.Any(x => x.ZipCode == "N/A").ShouldBe(true);
        }
예제 #5
0
        public void CleanAddresses_MessyAddressHasAddress_SplitsAdressOnCommasAndStoresCorrentValueIntoZipCode()
        {
            // Arrange
            var address = "42 Foo Dr., Some City, NY, 98210";

            var messyAddresses = new List <MessyAddressInformation>();

            messyAddresses.Add(new MessyAddressInformation {
                Address = address
            });

            // Act
            var classToTest = new MessyListToCleanList();
            var result      = classToTest.CleanAddresses(messyAddresses);

            // Assert
            result.Any(x => x.ZipCode == "98210").ShouldBe(true);
        }
예제 #6
0
        public void CleanAddresses_MessyAddressHasNameOfNothing_LastNameHasValueOfNA()
        {
            // Arrange
            var name = "";

            var messyAddresses = new List <MessyAddressInformation>();

            messyAddresses.Add(new MessyAddressInformation {
                Name = name
            });

            // Act
            var classToTest = new MessyListToCleanList();
            var result      = classToTest.CleanAddresses(messyAddresses);

            // Assert
            result.Any(x => x.LastName == "N/A").ShouldBe(true);
        }