Beispiel #1
0
        public void PropertyContext_SetProperty_Exists_Volatile_Test()
        {
            const int firstValue  = 5;
            const int secondValue = 10;
            var       target      = new PropertyContext(null);

            target.SetProperty("Test", firstValue, PropertyTypeOptions.Volatile);
            target.GetProperty <int>("Test").Should().Be(firstValue);

            target.SetProperty("Test", secondValue);
            target.GetProperty <int>("Test").Should().Be(secondValue);
        }
Beispiel #2
0
        public void SetProperty_StringName_Volatile_SetExisting_Fact()
        {
            var fake = new FakeEntity(1, "Fact");

            var ctx = new PropertyContext(fake);

            ctx.SetProperty("NullProperty", "Nothing", PropertyTypeOptions.Volatile);

            var result = ctx.GetProperty <string>("NullProperty");

            result.Should().Be("Nothing");

            ctx.SetProperty("NullProperty", "Still Nothing");

            result = ctx.GetProperty <string>("NullProperty");
            result.Should().Be("Still Nothing");
        }
Beispiel #3
0
        public void PropertyContext_GetBooleanProperty_Test()
        {
            var target = new PropertyContext(null);

            target.SetProperty("Test", true);

            const bool expected = true;
            var        actual   = target.GetProperty <bool>("Test");

            actual.Should().Be(expected);
        }
Beispiel #4
0
        public void PropertyContext_GetLongProperty_Test()
        {
            var target = new PropertyContext(null);

            target.SetProperty("Test", 10000000000000);

            const long expected = 10000000000000;
            var        actual   = target.GetProperty <long>("Test");

            actual.Should().Be(expected);
        }
Beispiel #5
0
        public void PropertyContext_GetIntProperty_Test()
        {
            var target = new PropertyContext(null);

            target.SetProperty("Test", 512);

            const int expected = 512;
            var       actual   = target.GetProperty <int>("Test");

            actual.Should().Be(expected);
        }
Beispiel #6
0
        public void PropertyContext_GetStringProperty_Test()
        {
            var target = new PropertyContext(null);

            target.SetProperty("Test", "Testing");

            const string expected = "Testing";
            var          actual   = target.GetProperty <string>("Test");

            actual.Should().Be(expected);
        }
Beispiel #7
0
        public void SetProperty_Enum_NoOptions_Fact()
        {
            var fake = new FakeEntity(1, "Fact");

            var ctx = new PropertyContext(fake);

            ctx.SetProperty(FactEnum.Fact1, "Nothing");

            var result = ctx.GetProperty <string>("Fact1");

            result.Should().Be("Nothing");
        }
Beispiel #8
0
        public void SetProperty_StringName_NoOptions_Fact()
        {
            var fake = new FakeEntity(1, "Fact");

            var ctx = new PropertyContext(fake);

            ctx.SetProperty("NullProperty", "Nothing");

            var result = ctx.GetProperty <string>("NullProperty");

            result.Should().Be("Nothing");
        }
Beispiel #9
0
        public void PropertyContext_GetProperty_Test()
        {
            var target = new PropertyContext(null);

            var expected = new object();

            target.SetProperty("Test", expected);

            var actual = target.GetProperty <object>("Test");

            actual.Should().Be(expected);
        }