Example #1
0
        public void DbHelpers_GetPropertyGetters_can_be_accessed_from_multiple_threads_concurrently()
        {
            ExecuteInParallel(
                () =>
            {
                var getters = DbHelpers.GetPropertyGetters(typeof(TypeWithALotOfProperties));

                var testType = new TypeWithALotOfProperties();

                Assert.Equal(47, getters.Count);
                Assert.Equal("Hello", getters["Property3"](testType));
                Assert.Equal(77, getters["Property26"](testType));
            });
        }
Example #2
0
        public void DbHelpers_GetPropertySetters_can_be_accessed_from_multiple_threads_concurrently()
        {
            ExecuteInParallel(
                () =>
            {
                var setters = DbHelpers.GetPropertySetters(typeof(TypeWithALotOfProperties));

                Assert.Equal(40, setters.Count);

                var testType = new TypeWithALotOfProperties();

                setters["Property10"](testType, "UnicornsOnTheRun");
                Assert.Equal("UnicornsOnTheRun", testType.Property10);

                setters["Property47"](testType, "UnicornNeXTcube");
                Assert.Equal("UnicornNeXTcube", testType.Property47);
            });
        }