当前位置: 首页>>代码示例>>C#>>正文


C# ServiceCollection.AddCqrsSpirit方法代码示例

本文整理汇总了C#中ServiceCollection.AddCqrsSpirit方法的典型用法代码示例。如果您正苦于以下问题:C# ServiceCollection.AddCqrsSpirit方法的具体用法?C# ServiceCollection.AddCqrsSpirit怎么用?C# ServiceCollection.AddCqrsSpirit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ServiceCollection的用法示例。


在下文中一共展示了ServiceCollection.AddCqrsSpirit方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CommandsRegister_AmbiguousCheck

        public void CommandsRegister_AmbiguousCheck()
        {
            // Arrange
            var serviceCollection = new ServiceCollection();

            // Act
            Assert.Throws<AmbiguousMatchException>(() => serviceCollection.AddCqrsSpirit(new[] { typeof(Command1), typeof(Command1Handler), typeof(Command11Handler), typeof(Command2), typeof(Command2Handler), typeof(Command3) }));
        }
开发者ID:sergeyzwezdin,项目名称:cqs.net,代码行数:8,代码来源:CqrsSpiritExtensionsTests.cs

示例2: QueriesRegister_AmbiguousCheck

        public void QueriesRegister_AmbiguousCheck()
        {
            // Arrange
            var serviceCollection = new ServiceCollection();

            // Act
            Assert.Throws<AmbiguousMatchException>(() => serviceCollection.AddCqrsSpirit(new[] { typeof(IQuery1), typeof(Query1), typeof(Query11), typeof(IQuery2), typeof(Query2), typeof(IQuery3) }));
        }
开发者ID:sergeyzwezdin,项目名称:cqs.net,代码行数:8,代码来源:CqrsSpiritExtensionsTests.cs

示例3: CommandsDispatcherRegister

        public void CommandsDispatcherRegister()
        {
            // Arrange
            var serviceCollection = new ServiceCollection();

            // Act
            serviceCollection.AddCqrsSpirit(new Assembly[] { });

            // Assert
            var dispatcher = serviceCollection.Find(s => s.ServiceType == typeof(ICommandsDispatcher));

            Assert.NotNull(dispatcher);
            Assert.Equal(ServiceLifetime.Singleton, dispatcher.Lifetime);
            Assert.Equal(typeof(CommandsDispatcher), dispatcher.ImplementationType);
        }
开发者ID:sergeyzwezdin,项目名称:cqs.net,代码行数:15,代码来源:CqrsSpiritExtensionsTests.cs

示例4: CommandsRegister

        public void CommandsRegister()
        {
            // Arrange
            var serviceCollection = new ServiceCollection();

            // Act
            serviceCollection.AddCqrsSpirit(new[] { typeof(Command1), typeof(Command1Handler), typeof(Command2), typeof(Command2Handler), typeof(Command3) });

            // Assert
            var handler1 = serviceCollection.Find(s => s.ServiceType == typeof(ICommandHandler<Command1>));
            Assert.NotNull(handler1);
            Assert.Equal(ServiceLifetime.Transient, handler1.Lifetime);
            Assert.Equal(typeof(Command1Handler), handler1.ImplementationType);

            var handler2 = serviceCollection.Find(s => s.ServiceType == typeof(ICommandHandler<Command2>));
            Assert.NotNull(handler2);
            Assert.Equal(ServiceLifetime.Transient, handler2.Lifetime);
            Assert.Equal(typeof(Command2Handler), handler2.ImplementationType);
        }
开发者ID:sergeyzwezdin,项目名称:cqs.net,代码行数:19,代码来源:CqrsSpiritExtensionsTests.cs

示例5: QueriesRegister

        public void QueriesRegister()
        {
            // Arrange
            var serviceCollection = new ServiceCollection();

            // Act
            serviceCollection.AddCqrsSpirit(new[] { typeof(IQuery1), typeof(Query1), typeof(IQuery2), typeof(Query2), typeof(IQuery3) });

            // Assert
            var query1 = serviceCollection.Find(s => s.ServiceType == typeof(IQuery1));
            Assert.NotNull(query1);
            Assert.Equal(ServiceLifetime.Transient, query1.Lifetime);
            Assert.Equal(typeof(Query1), query1.ImplementationType);

            var query2 = serviceCollection.Find(s => s.ServiceType == typeof(IQuery2));
            Assert.NotNull(query2);
            Assert.Equal(ServiceLifetime.Transient, query2.Lifetime);
            Assert.Equal(typeof(Query2), query2.ImplementationType);
        }
开发者ID:sergeyzwezdin,项目名称:cqs.net,代码行数:19,代码来源:CqrsSpiritExtensionsTests.cs

示例6: WorkflowsRegister

        public void WorkflowsRegister()
        {
            // Arrange
            var serviceCollection = new ServiceCollection();

            // Act
            serviceCollection.AddCqrsSpirit(new[] { typeof(IWorkflow1), typeof(Workflow1), typeof(IWorkflow2), typeof(Workflow2), typeof(IWorkflow3) });

            // Assert
            var workflow1 = serviceCollection.Find(s => s.ServiceType == typeof(IWorkflow1));
            Assert.NotNull(workflow1);
            Assert.Equal(ServiceLifetime.Transient, workflow1.Lifetime);
            Assert.Equal(typeof(Workflow1), workflow1.ImplementationType);

            var workflow2 = serviceCollection.Find(s => s.ServiceType == typeof(IWorkflow2));
            Assert.NotNull(workflow2);
            Assert.Equal(ServiceLifetime.Transient, workflow2.Lifetime);
            Assert.Equal(typeof(Workflow2), workflow2.ImplementationType);
        }
开发者ID:sergeyzwezdin,项目名称:cqs.net,代码行数:19,代码来源:CqrsSpiritExtensionsTests.cs

示例7: WorkflowsRegister_AmbiguousCheck

        public void WorkflowsRegister_AmbiguousCheck()
        {
            // Arrange
            var serviceCollection = new ServiceCollection();

            // Act
            Assert.Throws<AmbiguousMatchException>(() => serviceCollection.AddCqrsSpirit(new[] { typeof(IWorkflow1), typeof(Workflow1), typeof(Workflow11), typeof(IWorkflow2), typeof(Workflow2), typeof(IWorkflow3) }));
        }
开发者ID:sergeyzwezdin,项目名称:cqs.net,代码行数:8,代码来源:CqrsSpiritExtensionsTests.cs


注:本文中的ServiceCollection.AddCqrsSpirit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。