Esempio n. 1
0
                public void ReturnsTrueWhenPropertyExists()
                {
                    var props = new ConcreteDynmProp();

                    props.Properties.Key = "value";
                    props.ContainsProperty("Key").ShouldBeTrue();
                }
Esempio n. 2
0
                public void ThrowsExceptionWhenKeyIsEmptyString()
                {
                    var props = new ConcreteDynmProp();

                    Should.Throw <ArgumentException>(() => props.ContainsProperty(string.Empty));
                    Should.Throw <ArgumentException>(() => props.ContainsProperty(""));
                }
Esempio n. 3
0
                public void ThrowsExcecptionWhenCanNotConvert()
                {
                    var props = new ConcreteDynmProp();

                    props.Properties.Key = "value";
                    Should.Throw <InvalidCastException>(() => props.GetPropertyValueAs <FakeType>("Key"));
                }
Esempio n. 4
0
                public void ThrowsExceptionWhenKeyIsNotFound()
                {
                    var props = new ConcreteDynmProp();

                    props.Properties.Key = "value";

                    Should.Throw <DynamicValueNotFoundException>(() => props.GetPropertyValueAs <string>("AnotheKey"));
                }
Esempio n. 5
0
                public void ThrowsExceptionWhenKeyIsNull()
                {
                    var props = new ConcreteDynmProp();

                    props.Properties.Key = "value";

                    Should.Throw <ArgumentNullException>(() => props.GetPropertyValueAs <string>(null));
                }
Esempio n. 6
0
                public void ThrowsExceptionWhenKeyIsEmptyString()
                {
                    var props = new ConcreteDynmProp();

                    props.Properties.Key = "value";

                    Should.Throw <ArgumentException>(() => props.GetPropertyValueAs <string>(string.Empty));
                    Should.Throw <ArgumentException>(() => props.GetPropertyValueAs <string>(""));
                }
Esempio n. 7
0
            public void StoresAndReturnsValue()
            {
                var props = new ConcreteDynmProp();

                props.Properties.Key = "value";
                var val = props.Properties.Key;

                Assert.True(val.Equals("value"));
            }
Esempio n. 8
0
            public void DynamicPropertyNotInitializedUntilFirstAccess()
            {
                var props = new ConcreteDynmProp();

                props.IsInitialized.ShouldBeFalse();

                props.Properties.Key = "value";

                props.IsInitialized.ShouldBeTrue();
            }
Esempio n. 9
0
                public void CovertsBetweenTypes()
                {
                    var props = new ConcreteDynmProp();

                    props.Properties.MyNumber = 50;

                    var val = props.GetPropertyValueAs <string>("MyNumber");

                    val.GetType().ShouldBe(typeof(string));
                    val.Equals("50").ShouldBeTrue();
                }
Esempio n. 10
0
                public void ReturnsValueAsSpecifiedType()
                {
                    var props = new ConcreteDynmProp();

                    props.Properties.Key = "value";

                    var val = props.GetPropertyValueAs <string>("Key");

                    val.Equals("value").ShouldBeTrue();
                    val.GetType().ShouldBe(typeof(string));
                }
Esempio n. 11
0
            public void ThrowsExceptionWhenIndexDoesNotExists()
            {
                var props = new ConcreteDynmProp();

                Should.Throw <RuntimeBinderException>(() => props.Properties.Key);
            }
Esempio n. 12
0
                public void ReturnsFalseWhenPropertyDoesNotExist()
                {
                    var props = new ConcreteDynmProp();

                    props.ContainsProperty("Key1").ShouldBeFalse();
                }
Esempio n. 13
0
                public void ThrowsExceptionWhenKeyIsNull()
                {
                    var props = new ConcreteDynmProp();

                    Should.Throw <ArgumentNullException>(() => props.ContainsProperty(null));
                }