Пример #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);
        }