示例#1
0
        public void PropertyConstrains()
        {
            var cardsPi = typeof(CardSet <>).GetProperty("Cards", BindingFlags.NonPublic | BindingFlags.Instance);

            Assert.IsTrue(cardsPi.GetSetMethod(true).IsPrivate);
            Assert.IsTrue(cardsPi.GetGetMethod(true).IsPrivate);
            var typePi = BasicTests.GetProperty <Card, CardType>(c => c.Type);

            Assert.IsTrue(typePi.GetSetMethod(true).IsPrivate);
            var colorPi = BasicTests.GetProperty <Card, CardColor>(c => c.Color);

            Assert.IsTrue(colorPi.GetSetMethod(true).IsPrivate);
            var comparisonsPi = BasicTests.GetProperty <SortSummary, uint>(s => s.Comparisons);

            Assert.IsTrue(comparisonsPi.GetSetMethod(true).IsPrivate);
            Assert.AreEqual(typeof(uint), comparisonsPi.PropertyType);
            var swapsPi = BasicTests.GetProperty <SortSummary, uint>(s => s.Swaps);

            Assert.IsTrue(swapsPi.GetSetMethod(true).IsPrivate);
            Assert.AreEqual(typeof(uint), swapsPi.PropertyType);
        }