Пример #1
0
        public void ImplementationTest()
        {
            Context context = new Context();

            context.AddAbstraction <Spouse, Person>();
            context.AddAbstraction <Child, Person>();
            var implementors = context.GetImplementations <Person>();

            Assert.IsTrue(implementors.Count() == 2, "Expected 2 implementors.");
            Assert.IsTrue(implementors.First().SubType == typeof(Spouse), "Mismatch in subtype.");
            Assert.IsTrue(implementors.First().SuperType == typeof(Person), "Mismatch in supertype.");
        }
Пример #2
0
        public void AbstractionTest()
        {
            Context context = new Context();

            context.AddAbstraction <Spouse, Person>();
            context.AddAbstraction <Child, Person>();
            var abstractions = context.GetAbstractions <Spouse>();

            Assert.IsTrue(abstractions.Count() == 1, "Expected 1 abstraction.");
            Assert.IsTrue(abstractions.Single().SubType == typeof(Spouse), "Mismatch in subtype.");
            Assert.IsTrue(abstractions.Single().SuperType == typeof(Person), "Mismatch in supertype.");
        }