コード例 #1
0
        public void ConfigureServices_WithMultipleKeysAndMethodDecoratedWithBoth_MethodIsCalledForBoth()
        {
            var target = new TargetClass();

            target.ConfigureServices("Mno")(null);
            target.ConfigureServices("Pqr")(null);

            Assert.Equal(2, target.MnoPqrWasCalled);
        }
コード例 #2
0
        public void ConfigureServices_WithKeyForMethodWithoutCallback_IsCalled()
        {
            var target = new TargetClass();

            target.ConfigureServices("Jkl")(null);

            Assert.True(target.JklWasCalled);
        }
コード例 #3
0
        public void ConfigureServices_WithKey_CallsProtectedInstanceMethodWithAttributeAndReturnValue()
        {
            var target = new TargetClass();

            target.ConfigureServices("Def")(null);

            Assert.True(target.DefWasCalled);
        }
コード例 #4
0
        public void ConfigureServices_WithKey_CallsPrivateStaticMethodWithAttributeAndReturnValue()
        {
            var target = new TargetClass();

            target.ConfigureServices("Abc")(null);

            Assert.True(TargetClass.AbcWasCalled);
        }
コード例 #5
0
        public void ConfigureServices_WithKeyForMultipleMethods_AllCallbacksAreCalled()
        {
            var target = new TargetClass();

            target.ConfigureServices("Ghi")(null);

            Assert.True(target.Ghi0WasCalled, "Method with attribute");
            Assert.True(target.Ghi1WasCalled, "Method with matching name");
        }