示例#1
0
        public void CheckMethodsWithArgument()
        {
            Concept equatable = new Concept(new Requires("Equals", typeof(int)));

            Assert.True(equatable.Is <int>());
            Assert.True(equatable.Is <object>());
            Assert.True(equatable.Is <string>());
            Assert.True(equatable.Is <List <int> >());
        }
示例#2
0
        public void CheckOriginalMethods()
        {
            Concept addable = new Concept(new Requires("Add", typeof(int)));

            Assert.True(addable.Is <List <int> >());
            Assert.False(addable.Is <List <float> >()); // Oooooh first problem, but c++ worse

            Assert.False(addable.Is <int>());
        }
示例#3
0
        public void CheckMethodsWithoutArguments()
        {
            Concept hashable = new Concept(new Requires("GetHashCode"));

            Assert.True(hashable.Is <int>());
            Assert.True(hashable.Is <object>());
            Assert.True(hashable.Is <string>());
            Assert.True(hashable.Is <List <int> >());
        }
示例#4
0
        public void BoolExpressionRequires()
        {
            Concept even = new Concept(
                new Requires(34 % 2 == 0),
                new Requires(10 % 2 == 0),
                new Requires(new Requires(true).Is <object>())
                );

            Assert.True(even.Is <object>()); // use all type
        }