public void FindNearby_ShouldThrowAnInvalidLocationException_GivenInvalidCoordinates()
        {
            string expectedExceptionMessage = "Latitude or Longitude invalid. Latitude range is -90 to 90; Longitude range is -180 to 180";

            InvalidLocationException exception = Assert.Throws <InvalidLocationException>(() => service.FindNearby(91, 181, 500));

            Assert.Equal(expectedExceptionMessage, exception.Message);
        }
示例#2
0
        public void isValid_ShouldThrowAnInvalidLocationException_GivenMissingRequiredFieldsInForm()
        {
            Dictionary <string, StringValues> fields = new Dictionary <string, StringValues>();

            FormCollection form = new FormCollection(fields);

            InvalidLocationException exception = Assert.Throws <InvalidLocationException>(() => validator.isValid(form));

            Assert.Equal("Payload missing required fields, please check the documentation.", exception.Message);
        }
示例#3
0
        public void isValid_ShouldThrowAnInvalidLocationException_GivenInvalidCoordinatesAreSent(string lat, string lng, string expectedExceptionMessage)
        {
            Dictionary <string, StringValues> fields = CreateValidFormFields();

            fields["Lat"] = new StringValues(lat);
            fields["Lng"] = new StringValues(lng);

            FormCollection form = new FormCollection(fields);

            InvalidLocationException exception = Assert.Throws <InvalidLocationException>(() => validator.isValid(form));

            Assert.Equal(expectedExceptionMessage, exception.Message);
        }