Example #1
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);
            });
        }