コード例 #1
0
        public ZoneParsingTests()
        {
            var regex    = new RegexCache(new Abbreviations());
            var mediator = new Mock <IMediator>();

            mediator.Setup(x => x.Send(It.IsAny <AddressSystemFromPlace.Command>(),
                                       It.IsAny <CancellationToken>()))
            .Returns((AddressSystemFromPlace.Command g, CancellationToken t) => {
                if (g.CityKey == "alta")
                {
                    return(Task.FromResult(new[] { new PlaceGridLink("alta", "grid", 1) } as
                                           IReadOnlyCollection <GridLinkable>));
                }

                return(Task.FromResult(Array.Empty <GridLinkable>() as IReadOnlyCollection <GridLinkable>));
            });

            _handler = new ZoneParsing.Handler(regex, mediator.Object, new Mock <ILogger>().Object);
        }
コード例 #2
0
        public DoubleAveExceptionTests()
        {
            var mediator = new Mock <IMediator>();

            mediator.Setup(x => x.Send(It.IsAny <AddressSystemFromPlace.Command>(), It.IsAny <CancellationToken>()))
            .Returns((AddressSystemFromPlace.Command g, CancellationToken t) => {
                if (g?.CityKey == "slc")
                {
                    return(Task.FromResult(new[] { new PlaceGridLink("slc", "salt lake city", 1) } as
                                           IReadOnlyCollection <GridLinkable>));
                }

                return(Task.FromResult(Array.Empty <GridLinkable>() as IReadOnlyCollection <GridLinkable>));
            });
            mediator.Setup(x => x.Send(It.IsAny <AddressSystemFromZipCode.Command>(), It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(Array.Empty <GridLinkable>() as IReadOnlyCollection <GridLinkable>));

            var regex = new RegexCache(new Abbreviations());

            _handler =
                new DoubleAvenuesException.DoubleAvenueExceptionPipeline <ZoneParsing.Command, GeocodeAddress>(regex, new Mock <ILogger>().Object);
            _requestHandler = new ZoneParsing.Handler(regex, mediator.Object, new Mock <ILogger>().Object);
        }