public void GivenDoubleProperty_WhenGetStructuredData_ThenReturnsCorrectValue()
        {
            var serviceLocator = Substitute.For <IServiceLocator>();

            serviceLocator.TryGetExistingInstance(typeof(IPropertyHandler <double>), out var _).Returns(x =>
            {
                x[1] = new DoublePropertyHandler(_contentSerializerSettings);
                return(true);
            });
            ServiceLocator.SetLocator(serviceLocator);

            var result = this._sut.GetStructuredData(_page, this._contentSerializerSettings);

            result.ShouldContain(x => x.Key.Equals(nameof(StandardPage.Degrees)) && x.Value.Equals(_page.Degrees));
        }
Ejemplo n.º 2
0
        private ILineHandler CreateLineHandler()
        {
            ILineHandler instanceOfHandler = new InstanceOfHandler(builder);
            ILineHandler stringHandler = new StringPropertyHandler(builder);
            ILineHandler doubleHandler = new DoublePropertyHandler(builder);
            ILineHandler intHandler = new IntPropertyHandler(builder);
            ILineHandler nestedHandler = new NestedPropertyHandler(builder);
            ILineHandler endInstanceHandler = new EndOfInstanceHandler(builder);

            instanceOfHandler.Successor = stringHandler;
            stringHandler.Successor = doubleHandler;
            doubleHandler.Successor = intHandler;
            intHandler.Successor = nestedHandler;
            nestedHandler.Successor = endInstanceHandler;

            return instanceOfHandler;
        }
Ejemplo n.º 3
0
        private ILineHandler CreateLineHandler()
        {
            ILineHandler instanceOfHandler  = new InstanceOfHandler(builder);
            ILineHandler stringHandler      = new StringPropertyHandler(builder);
            ILineHandler doubleHandler      = new DoublePropertyHandler(builder);
            ILineHandler intHandler         = new IntPropertyHandler(builder);
            ILineHandler nestedHandler      = new NestedPropertyHandler(builder);
            ILineHandler endInstanceHandler = new EndOfInstanceHandler(builder);

            instanceOfHandler.Successor = stringHandler;
            stringHandler.Successor     = doubleHandler;
            doubleHandler.Successor     = intHandler;
            intHandler.Successor        = nestedHandler;
            nestedHandler.Successor     = endInstanceHandler;

            return(instanceOfHandler);
        }
Ejemplo n.º 4
0
 public DoublePropertyHandlerTests()
 {
     this._sut = new DoublePropertyHandler();
 }
Ejemplo n.º 5
0
 public DoublePropertyHandlerTests()
 {
     this._sut = new DoublePropertyHandler(new ContentSerializerSettings());
 }