Ejemplo n.º 1
0
        private static void ShouldFindOneShape(string input, string expectedUnusedInput)
        {
            var testSubject = new TrivialFormatter();

            AssertParsesOneShape(testSubject, input, ExpectedGeographyResult, expectedUnusedInput);
            AssertParsesOneShape(testSubject, input, ExpectedGeometryResult, expectedUnusedInput);
        }
Ejemplo n.º 2
0
        public void ParseGivesValidationgPipeline()
        {
            // this test is bad, we have a task to fix the api to be testable
            var builder = new TrivialFormatter().GetValidatingBuilder();
            var pipe    = builder.Key;

            AssertThrows <FormatException>(() => pipe.GeometryPipeline.EndFigure());
        }
Ejemplo n.º 3
0
        private static void AssertParsesOneShape <TExpectedType>(TrivialFormatter testSubject, string input, TExpectedType expected,
                                                                 string expectedUnusedInput) where TExpectedType : class, ISpatial
        {
            var reader = new StringReader(input);
            var actual = testSubject.Read <TExpectedType>(reader);

            Assert.AreEqual(expected, actual);
            Assert.AreEqual(expectedUnusedInput, reader.ReadToEnd());
        }
Ejemplo n.º 4
0
        private static void ShouldFindNothing(string input)
        {
            var testSubject = new TrivialFormatter();

            Assert.AreEqual(MissingLineMessage,
                            AssertThrows <ParseErrorException>(() => testSubject.Read <GeographyPoint>(new StringReader(input))).Message);

            Assert.AreEqual(MissingLineMessage,
                            AssertThrows <ParseErrorException>(() => testSubject.Read <GeometryPoint>(new StringReader(input))).Message);
        }