Exemplo n.º 1
0
        public void ConvertToDynamicObjectReturnsDynamicObject()
        {
            var obj = new TestLanguageChangedEventArgs {
                Language = "English"
            };

            ExpandoObject expando = obj.ConvertToExpando();

            Assert.IsNotNull(expando);
        }
Exemplo n.º 2
0
        public void ConvertToDynamicObjectReturnsDynamicObjectWithProperties()
        {
            var obj = new TestLanguageChangedEventArgs {
                Language = "English"
            };

            ExpandoObject expando = obj.ConvertToExpando();

            Assert.IsTrue(((IDictionary <string, object>)expando).ContainsKey("Language"));
        }
Exemplo n.º 3
0
        public void ConvertToDynamicObjectReturnsDynamicObjectWithPropertyValue()
        {
            var obj = new TestLanguageChangedEventArgs {
                Language = "English"
            };

            ExpandoObject expando = obj.ConvertToExpando();

            var result = ((IDictionary <string, object>)expando)["Language"];

            Assert.AreEqual("English", result);
        }
Exemplo n.º 4
0
        public void ConvertToDynamicObjectThrowsIfObjectIsNull()
        {
            TestLanguageChangedEventArgs obj = null;

            Assert.Throws <ArgumentNullException>(() => obj.ConvertToExpando());
        }