public ThingPropertyTest()
        {
            _fixture              = new Fixture();
            _thing                = new FakeThing();
            _jsonConvertible      = Substitute.For <IJsonConvertible>();
            _jsonSchemaValidation = Substitute.For <IJsonSchemaValidation>();
            _convertible          = Substitute.For <Mozilla.IoT.WebThing.Convertibles.IConvertible>();

            _setter = (thing, value) => ((FakeThing)thing).Value = value;
            _getter = thing => ((FakeThing)thing).Value;

            _originPropertyName = _fixture.Create <string>();
        }
        public void Presentation_001_StaticVariablesDemonstration()
        {
            FakeThing.StaticId = 1;
            FakeThing.StaticId = 2;
            FakeThing.StaticId = 3;
            FakeThing.StaticId = 4;

            Assert.AreEqual(4, FakeThing.StaticId);

            var instanceOne = new FakeThing();
            var instanceTwo = new FakeThing();

            instanceOne.SetStaticId(499);
            Assert.AreEqual(499, FakeThing.StaticId);
            Assert.AreEqual(499, instanceOne.GetStaticId());
            Assert.AreEqual(499, instanceTwo.GetStaticId());
        }
Example #3
0
        public PropertyFactoryTest()
        {
            _jsonSchemaValidationFactory = Substitute.For <IJsonSchemaValidationFactory>();
            _jsonConvertibleFactory      = Substitute.For <IJsonConvertibleFactory>();
            _convertibleFactory          = Substitute.For <IConvertibleFactory>();

            _fixture = new Fixture();

            _jsonSchema = new JsonSchema(Substitute.For <IJsonSchema>(), _fixture.Create <object[]>(),
                                         _fixture.Create <JsonType>(), _fixture.Create <string>(), _fixture.Create <bool>());

            _thing = new FakeThing();

            _setter = (thing, value) => ((FakeThing)thing).Value = value;
            _getter = thing => ((FakeThing)thing).Value;

            _factory = new PropertyFactory(_jsonSchemaValidationFactory, _jsonConvertibleFactory, _convertibleFactory);
        }