Example #1
0
        public void AsShape_Extensions_Should_OK()
        {
            var     mockShapeModel = MockShapeModel.Create();
            dynamic result         = mockShapeModel.AsShape(" ID, NaMe ", true);

            ((object)result).Log();
            ((int)result.ID).ShouldEqual(1);
            ((string)result.NaMe).ShouldEqual(mockShapeModel.Name);
        }
Example #2
0
        public void ShapeData_AutoTrim_IgnoreCase_Should_OK()
        {
            var     instance       = Create();
            var     mockShapeModel = MockShapeModel.Create();
            dynamic result         = instance.ShapeData(mockShapeModel, " ID, NaMe ", true);

            ((object)result).Log();
            ((int)result.ID).ShouldEqual(1);
            ((string)result.NaMe).ShouldEqual(mockShapeModel.Name);
        }
Example #3
0
        public void ShapeData_NotExitProperties_Should_FillNull()
        {
            var     instance       = Create();
            var     mockShapeModel = MockShapeModel.Create();
            dynamic result         = instance.ShapeData(mockShapeModel, "Id,Name,Bar", true);

            ((object)result).Log();
            ((int)result.Id).ShouldEqual(1);
            ((string)result.Name).ShouldEqual(mockShapeModel.Name);
            ((object)result.Bar).ShouldNull();
        }
Example #4
0
        public void ShapeData_NotExitProperties_Should_FillByArgs()
        {
            var     instance       = Create();
            var     mockShapeModel = MockShapeModel.Create();
            dynamic result         = instance.ShapeData(mockShapeModel, "Id,Name,Bar", false);

            ((object)result).Log();
            ((int)result.Id).ShouldEqual(1);
            ((string)result.Name).ShouldEqual(mockShapeModel.Name);
            AssertHelper.ShouldThrows <RuntimeBinderException>(() =>
            {
                var test = result.Bar;
            });
        }