Exemplo n.º 1
0
        public void Returns_Dynamic_Object_From_ToDynamic_When_Source_Is_Provided()
        {
            // arrange
            var source = new SampleClass1();

            // act
            dynamic result = source.ToDynamic();

            // assert
            Assert.IsInstanceOfType(result, typeof(ExpandoObject));
            Assert.AreEqual(source.Id, result.id);
            Assert.AreEqual(source.Description, result.description);
            Assert.AreEqual(source.Count, result.count);
        }
Exemplo n.º 2
0
        public void Returns_Dynamic_Object_From_ToDynamic_When_ExpandedProperties_Is_Provided()
        {
            // arrange
            var source             = new SampleClass1();
            int myRightFace        = 12;
            var expandedProperties = new Dictionary <string, object>()
            {
                { "MyRightFace", myRightFace }
            };

            // act
            dynamic result = source.ToDynamic(expandedProperties);

            // assert
            Assert.IsInstanceOfType(result, typeof(ExpandoObject));
            Assert.AreEqual(source.Id, result.id);
            Assert.AreEqual(source.Count, result.count);
            Assert.AreEqual(source.Description, result.description);
            Assert.AreEqual(myRightFace, result.myRightFace);
        }