Esempio n. 1
0
        public void GetFragmentTypes_PrioritizesLayers()
        {
            var lowerPriorityStub = MockRepository.GenerateStub <IBlacklistManager>();
            var lowerPriorityFragmentSignature = new FragmentSignature(new string[0], "ReturnType", false);

            lowerPriorityStub
            .Stub(stub => stub.GetFragmentTypes(_assemblyName, _typename, _methodname, _parameters))
            .Return(lowerPriorityFragmentSignature);

            var higherPriorityStub = MockRepository.GenerateStub <IBlacklistManager>();
            var higherPriorityFragmentSignature = new FragmentSignature(new string[0], "ReturnType", false);

            higherPriorityStub
            .Stub(stub => stub.GetFragmentTypes(_assemblyName, _typename, _methodname, _parameters))
            .Return(higherPriorityFragmentSignature);

            var layers = new Stack <IBlacklistManager>();

            layers.Push(lowerPriorityStub);
            layers.Push(higherPriorityStub);

            var layeredConfigurationAdapter = new LayeredConfigurationAdapter(layers);

            Assert.That(
                layeredConfigurationAdapter.GetFragmentTypes(_assemblyName, _typename, _methodname, _parameters),
                Is.SameAs(higherPriorityFragmentSignature));
        }
Esempio n. 2
0
        public void GetFragmentTypes_UnknownMethod()
        {
            var blacklistManagerStub = MockRepository.GenerateStub <IBlacklistManager>();
            var layers = new Stack <IBlacklistManager>();

            layers.Push(blacklistManagerStub);

            var layeredConfigurationAdapter = new LayeredConfigurationAdapter(layers);

            Assert.That(layeredConfigurationAdapter.GetFragmentTypes(_assemblyName, _typename, _methodname, _parameters), Is.Null);
        }
Esempio n. 3
0
        public void GetFragmentTypes_ReturnsFragmentType()
        {
            var blacklistManagerStub = MockRepository.GenerateStub <IBlacklistManager>();
            var expected             = new FragmentSignature(new string[0], "ReturnType", false);

            blacklistManagerStub
            .Stub(stub => stub.GetFragmentTypes(_assemblyName, _typename, _methodname, _parameters))
            .Return(expected);

            var layers = new Stack <IBlacklistManager>();

            layers.Push(blacklistManagerStub);

            var layeredConfigurationAdapter = new LayeredConfigurationAdapter(layers);

            Assert.That(layeredConfigurationAdapter.GetFragmentTypes(_assemblyName, _typename, _methodname, _parameters), Is.SameAs(expected));
        }