Ejemplo n.º 1
0
        public void MixedAddressLinesSortedCorrectly()
        {
            AddressDetailsResponse a1 = new AddressDetailsResponse()
            {
                AddressLine1 = "5 The 1 building",
                AddressLine2 = "aaa",
                AddressLine3 = "aaa",
                Locality     = null
            };

            AddressDetailsResponse a2 = new AddressDetailsResponse()
            {
                AddressLine1 = "5 The 1100 building",
                AddressLine2 = "aaa",
                AddressLine3 = "aaa",
                Locality     = null
            };

            AddressDetailsResponse a3 = new AddressDetailsResponse()
            {
                AddressLine1 = "5 The 101 building",
                AddressLine2 = "aaa",
                AddressLine3 = "aaa",
                Locality     = null
            };

            AddressDetailsResponse a4 = new AddressDetailsResponse()
            {
                AddressLine1 = "5 The 2 building",
                AddressLine2 = "aaa",
                AddressLine3 = "aaa",
                Locality     = null
            };

            AddressDetailsResponse a5 = new AddressDetailsResponse()
            {
                AddressLine1 = "4 The 2 building",
                AddressLine2 = "aaa",
                AddressLine3 = "aaa",
                Locality     = null
            };

            IEnumerable <AddressDetailsResponse> addressDetails = new List <AddressDetailsResponse>()
            {
                a1, a2, a3, a4, a5
            };

            AddressDetailsSorter addressDetailsSorter     = new AddressDetailsSorter();
            IReadOnlyList <AddressDetailsResponse> result = addressDetailsSorter.OrderAddressDetailsResponse(addressDetails);

            List <AddressDetailsResponse> sorted = new List <AddressDetailsResponse>
            {
                a5, a1, a4, a3, a2
            };


            CollectionAssert.AreEqual(sorted.ToList(), result.ToList());
        }
Ejemplo n.º 2
0
        public void BuildingNumbersSortedCorrectly()
        {
            AddressDetailsResponse a1 = new AddressDetailsResponse()
            {
                AddressLine1 = "1",
                AddressLine2 = "aaa",
                AddressLine3 = "aaa",
                Locality     = null
            };

            AddressDetailsResponse a2 = new AddressDetailsResponse()
            {
                AddressLine1 = "1100",
                AddressLine2 = "aaa",
                AddressLine3 = "aaa",
                Locality     = null
            };

            AddressDetailsResponse a3 = new AddressDetailsResponse()
            {
                AddressLine1 = "101",
                AddressLine2 = "aaa",
                AddressLine3 = "aaa",
                Locality     = null
            };

            AddressDetailsResponse a4 = new AddressDetailsResponse()
            {
                AddressLine1 = "2",
                AddressLine2 = "aaa",
                AddressLine3 = "aaa",
                Locality     = null
            };

            IEnumerable <AddressDetailsResponse> addressDetails = new List <AddressDetailsResponse>()
            {
                a1, a2, a3, a4
            };

            AddressDetailsSorter addressDetailsSorter     = new AddressDetailsSorter();
            IReadOnlyList <AddressDetailsResponse> result = addressDetailsSorter.OrderAddressDetailsResponse(addressDetails);

            List <AddressDetailsResponse> sorted = new List <AddressDetailsResponse>
            {
                a1, a4, a3, a2
            };


            CollectionAssert.AreEqual(sorted.ToList(), result.ToList());
        }
Ejemplo n.º 3
0
        public void ExactSubstringSortedCorrectly()
        {
            AddressDetailsResponse a1 = new AddressDetailsResponse()
            {
                AddressLine1 = "Building",
                AddressLine2 = "aaa",
                AddressLine3 = "aaa",
                Locality     = null
            };

            AddressDetailsResponse a2 = new AddressDetailsResponse()
            {
                AddressLine1 = "Build",
                AddressLine2 = "aaa",
                AddressLine3 = "aaa",
                Locality     = null
            };

            AddressDetailsResponse a3 = new AddressDetailsResponse()
            {
                AddressLine1 = "Building 10",
                AddressLine2 = "aaa",
                AddressLine3 = "aaa",
                Locality     = null
            };


            IEnumerable <AddressDetailsResponse> addressDetails = new List <AddressDetailsResponse>()
            {
                a1, a2, a3
            };

            AddressDetailsSorter addressDetailsSorter     = new AddressDetailsSorter();
            IReadOnlyList <AddressDetailsResponse> result = addressDetailsSorter.OrderAddressDetailsResponse(addressDetails);

            List <AddressDetailsResponse> sorted = new List <AddressDetailsResponse>
            {
                a2, a1, a3
            };


            CollectionAssert.AreEqual(sorted.ToList(), result.ToList());
        }