Example #1
0
        public void ConstructorShouldConstructWithSetters()
        {
            // Arrange (set up variables for row constructor)
            var text     = "Some Text";
            var value    = 1734542d;
            var distance = new ResponseDistance
            {
                Text  = text,
                Value = value
            };
            var duration = new ResponseDuration
            {
                Text  = text + value,
                Value = value
            };
            var status  = "Single";
            var element = new ResponseElement
            {
                Distance = distance,
                Duration = duration,
                Status   = status
            };
            // Act (create row with variables)
            var row = new ResponseRow
            {
                Elements = new List <ResponseElement> {
                    element
                }
            };

            // Assert (ensure model properties are set to variables)
            Assert.NotNull(row.Elements);
            Assert.Single(row.Elements);
            Assert.Equal(element, row.Elements[0]);
        }
Example #2
0
        public void ConstructorShouldConstructWithSetters()
        {
            // Arrange (create variables for model properties)
            var text     = "Some Text";
            var value    = 1734542d;
            var distance = new ResponseDistance
            {
                Text  = text,
                Value = value
            };
            var duration = new ResponseDuration
            {
                Text  = text + value,
                Value = value
            };
            var status = "Single";
            // Act (create model with variables)
            var element = new ResponseElement
            {
                Distance = distance,
                Duration = duration,
                Status   = status
            };

            // Assert (ensure the properties are set to the proper variables)
            Assert.Equal(distance, element.Distance);
            Assert.Equal(duration, element.Duration);
            Assert.Equal(status, element.Status);
        }
Example #3
0
        public void ConstructorShouldConstructWithSetters()
        {
            // Arrange (set up variables for the Distance Matrix)
            var text     = "Some Text";
            var value    = 1734542d;
            var distance = new ResponseDistance
            {
                Text  = text,
                Value = value
            };
            var duration = new ResponseDuration
            {
                Text  = text + value,
                Value = value
            };
            var status  = "Single";
            var element = new ResponseElement
            {
                Distance = distance,
                Duration = duration,
                Status   = status
            };
            var row1 = new ResponseRow
            {
                Elements = new List <ResponseElement> {
                    element, element
                }
            };
            var row2 = new ResponseRow
            {
                Elements = new List <ResponseElement> {
                    element, element
                }
            };
            // Act (create a DistanceMatrixResponse object by passing in parameters)
            var response = new Response
            {
                DestinationAddresses = new List <string> {
                    "2124 Parker St.", "2399 Prospect St."
                },
                OriginAddresses = new List <string> {
                    "2132 Oxford St.", "2216 Blake St."
                },
                Rows = new List <ResponseRow> {
                    row1, row2
                },
                Status = status
            };

            // Assert (ensure the properties are set to the values)
            Assert.Equal(2, response.DestinationAddresses.Count);
            Assert.Equal(2, response.OriginAddresses.Count);
            Assert.Equal(2, response.Rows.Count);
            Assert.Equal(status, response.Status);
        }
        public void ConstructorShouldConstructWithSetters()
        {
            // Arrange (create variables for constructor)
            var text  = "Some Text";
            var value = 1734542d;
            // Act (initialize properties with variables in constructor)
            var distance = new ResponseDistance
            {
                Text  = text,
                Value = value
            };

            // Assert (ensure the properties are set to the proper variables)
            Assert.Equal(text, distance.Text);
            Assert.Equal(value, distance.Value);
        }