Пример #1
0
        public void InterceptorReturnsSingleMethod()
        {
            List <MethodImplementationInfo> methods = GetMethods <SingleInterceptableMethod>();

            CollectionAssertExtensions.AreEquivalent(GetOnlyImplementations(typeof(SingleInterceptableMethod), "MyMethod"),
                                                     methods);
        }
Пример #2
0
        public void InterfacePropertiesAreReturned()
        {
            List <MethodImplementationInfo> methods = GetMethods <PropThroughInterface>();

            CollectionAssertExtensions.AreEquivalent(
                GetExpectedMethodImplementations(typeof(IHasProperties), typeof(PropThroughInterface)),
                methods);
        }
Пример #3
0
        public void PropertiesAreReturnedAsGetAndSetMethods()
        {
            List <MethodImplementationInfo> methods = GetMethods <HasProperties>();

            CollectionAssertExtensions.AreEquivalent(
                GetOnlyImplementations(typeof(HasProperties), "get_SettableProp", "set_SettableProp", "get_GetOnly"),
                methods);
        }
Пример #4
0
        public void EmptyInterfacesContributeNoMethods()
        {
            List <MethodImplementationInfo> methods = GetMethods <Marked>();

            CollectionAssertExtensions.AreEquivalent(
                GetExpectedMethodImplementations(typeof(IMyOperations), typeof(Marked)),
                methods);
        }
Пример #5
0
        public void InterceptorReturnsAllMethodsIncludingInheritedOnes()
        {
            List <MethodImplementationInfo> methods = GetMethods <InheritsSingleMethodAndAdds>();

            CollectionAssertExtensions.AreEquivalent(
                GetOnlyImplementations(typeof(InheritsSingleMethodAndAdds), "MyMethod", "AnotherMethod", "StillMoreMethod"),
                methods);
        }
Пример #6
0
        public void MBROReturnBothInterfaceAndClassProperties()
        {
            List <MethodImplementationInfo> methods = GetMethods <MBROWithPropThroughInterface>();

            var expected = GetExpectedMethodImplementations(typeof(IHasProperties), typeof(MBROWithPropThroughInterface))
                           .Concat(GetOnlyImplementations(typeof(MBROWithPropThroughInterface), "get_Gettable"));

            CollectionAssertExtensions.AreEquivalent(expected.ToList(), methods);
        }
Пример #7
0
        public void ReturnsAllInterfaceMethods()
        {
            List <MethodImplementationInfo> methods = GetMethods <Incoherent>();

            CollectionAssertExtensions.AreEquivalent(
                GetExpectedMethodImplementations(typeof(IMyOperations), typeof(Incoherent))
                .Concat(GetExpectedMethodImplementations(typeof(ImTiredOfInterfaces), typeof(Incoherent))).ToList(),
                methods);
        }
Пример #8
0
        public void ExplicitImplementationsAreFound()
        {
            List <MethodImplementationInfo> methods = GetMethods <ExplicitImplementation>();

            var expected = GetExpectedMethodImplementations(typeof(IMyOperations), typeof(ExplicitImplementation))
                           .Concat(GetOnlyImplementations(typeof(ExplicitImplementation), "AClassMethod"));

            CollectionAssertExtensions.AreEquivalent(expected.ToList(), methods);
        }
Пример #9
0
        public void NonMBROReturnsInterfaceMethods()
        {
            List <MethodImplementationInfo> methods = GetMethods <Operations>();

            Assert.AreEqual(2, methods.Count);

            List <MethodImplementationInfo> expected = GetExpectedMethodImplementations(typeof(IMyOperations), typeof(Operations));

            CollectionAssertExtensions.AreEquivalent(expected, methods);
        }
Пример #10
0
        public void NamesRegisteredInParentAppearInChildGetAll()
        {
            string[]       databases = { "northwind", "adventureworks", "fabrikam" };
            UnityContainer parent    = new UnityContainer();

            parent.RegisterInstance <string>("nwnd", databases[0])
            .RegisterInstance <string>("advwks", databases[1]);

            IUnityContainer child = parent.CreateChildContainer()
                                    .RegisterInstance <string>("fbkm", databases[2]);

            List <string> dbs = new List <string>(child.ResolveAll <string>());

            CollectionAssertExtensions.AreEquivalent(databases, dbs);
        }