Example #1
0
        public void BindMapsFromOneResultTypeToAnother()
        {
            var result = IntResult.Ok(21);
            var actual =
                result
                .Bind(r => DoubleResult.Ok(r + 1.0));

            Assert.AreEqual(22.0, actual.Unwrap());
        }
Example #2
0
        public void AddDouble(int row, int column, double expected, double epsilon, double?min = null, double?max = null)
        {
            DoubleResult result = new DoubleResult()
            {
                Epsilon = epsilon,
                Value   = expected,
                Min     = min,
                Max     = max
            };

            Add(row, column, result);
        }
Example #3
0
	    public virtual bool RunTest()
        {
            if (_geometryOperation != null)
            {
                var arguments = ToArguments();

                IResult expectedResult = null;
                var returnType = _geometryOperation.GetReturnType(_enumTestType);
                if (returnType == typeof(int))
                    expectedResult = new IntegerResult((int)Result);
                else if (returnType == typeof(bool))
                    expectedResult = new BooleanResult((bool)Result);
                else if (returnType == typeof(double))
                    expectedResult = new DoubleResult((int)Result);
                else if (returnType == typeof(IGeometry))
                    expectedResult = new GeometryResult((IGeometry)Result);
                else
                {
                    Debug.Assert(false);
                }

                var result = _geometryOperation.Invoke(_enumTestType, IsDefaultTarget ? _objGeometryA : _objGeometryB, ToArguments());
                if (_resultMatcher == null)
                    _resultMatcher = CreateEqualityResultMatcher(returnType);
                                         {
                return _resultMatcher.IsMatch(IsDefaultTarget ? _objGeometryA : _objGeometryB, _enumTestType.ToString(),
                                           arguments, result, expectedResult, _dTolerance);
                }
            }
            
            switch (_enumTestType) 
            {
                case XmlTestType.Area:
                    return TestArea();

                case XmlTestType.Boundary:
                    return TestBoundary();

                case XmlTestType.BoundaryDimension:
                    return TestBoundaryDimension();

                case XmlTestType.Buffer:
                    return TestBuffer();

                case XmlTestType.BufferMitredJoin:
                    return TestBufferMitredJoin();

                case XmlTestType.Centroid:
                    return TestCentroid();

                case XmlTestType.Contains:
                    return TestContains();

                case XmlTestType.ConvexHull:
                    return TestConvexHull();

                case XmlTestType.Crosses:
                    return TestCrosses();

                case XmlTestType.Densify:
                    return TestDensify();

                case XmlTestType.Difference:
                    return TestDifference();

                case XmlTestType.Dimension:
                    return TestDimension();

                case XmlTestType.Disjoint:
                    return TestDisjoint();

                case XmlTestType.Distance:
                    return TestDistance();

                case XmlTestType.Envelope:
                    return TestEnvelope();

                case XmlTestType.Equals:
                    return TestEquals();

                case XmlTestType.InteriorPoint:
                    return TestInteriorPoint();

                case XmlTestType.Intersection:
                    return TestIntersection();

                case XmlTestType.Intersects:
                    return TestIntersects();

                case XmlTestType.IsEmpty:
                    return TestIsEmpty();

                case XmlTestType.IsSimple:
                    return TestIsSimple();

                case XmlTestType.IsValid:
                    return TestIsValid();

                case XmlTestType.IsWithinDistance:
                    return TestIsWithinDistance();

                case XmlTestType.Length:
                    return TestLength();

                case XmlTestType.NumPoints:
                    return TestNumPoints();

                case XmlTestType.Overlaps:
                    return TestOverlaps();

                case XmlTestType.Relate:
                    return TestRelate();

                case XmlTestType.SRID:
                    return TestSRID();

                case XmlTestType.SymmetricDifference:
                    return TestSymDifference();

                case XmlTestType.Touches:
                    return TestTouches();

                case XmlTestType.Union:
                    return TestUnion();

                case XmlTestType.Within:
                    return TestWithin();

                case XmlTestType.Covers:
                    return TestCovers();

                case XmlTestType.CoveredBy:
                    return TestCoveredBy();

                case XmlTestType.EqualsExact:
                    return TestEqualsExact();

                case XmlTestType.EqualsNorm:
                    return TestEqualsNorm();

                case XmlTestType.MinClearance:
                    return TestMinClearance();

                case XmlTestType.MinClearanceLine:
                    return TestMinClearanceLine();
                
                case XmlTestType.EqualsTopo:
                    return TestEqualsTopo();

                default:
                    string format = String.Format("Test not implemented: {0}", this._enumTestType);
                    throw new NotImplementedException(format);
            }
        }