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


C# Subscriber.WaitMessages方法代码示例

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


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

示例1: OnChanged_TriggersEvent_UpdatesData

        public void OnChanged_TriggersEvent_UpdatesData()
        {
            var subscriber = new Subscriber<CharacterDirectoriesChanged>(Fixture.WurmApiManager.InternalEventAggregator);
            var batman = ClientMock.AddPlayer("Batman");
            subscriber.WaitMessages(1);

            // verifying event sent
            Expect(subscriber.ReceivedMessages.Count(), GreaterThan(0));

            // verifying data updated
            var allChars = System.GetAllCharacters().ToList();
            var allDirFullPaths = System.AllDirectoriesFullPaths.ToList();
            var allDirNames = System.AllDirectoryNamesNormalized.ToList();
            Expect(allChars, Member(new CharacterName(batman.Name)).And.Count.EqualTo(1));
            Expect(allDirFullPaths, Member(batman.PlayerDir.FullName).And.Count.EqualTo(1));
            Expect(allDirNames, Member(batman.PlayerDir.Name.ToUpperInvariant()).And.Count.EqualTo(1));
        }
开发者ID:imtheman,项目名称:WurmApi,代码行数:17,代码来源:WurmCharacterDirectoriesTests.cs

示例2: TriggersOnChanged

        public void TriggersOnChanged()
        {
            var subscriber = new Subscriber<ConfigDirectoriesChanged>(Fixture.WurmApiManager.InternalEventAggregator);
            var batman = ClientMock.AddConfig("batmobile");
            subscriber.WaitMessages(1);

            // verifying event sent
            Expect(subscriber.ReceivedMessages.Count(), GreaterThan(0));

            // verifying data updated
            var allConfigs = System.AllConfigNames.ToList();
            var allDirFullPaths = System.AllDirectoriesFullPaths.ToList();
            var allDirNames = System.AllDirectoryNamesNormalized.ToList();
            Expect(allConfigs, Member(batman.NameNormalized).And.Count.EqualTo(1));
            Expect(allDirFullPaths, Member(batman.ConfigDir.FullName).And.Count.EqualTo(1));
            Expect(allDirNames, Member(batman.ConfigDir.Name.ToUpperInvariant()).And.Count.EqualTo(1));
        }
开发者ID:imtheman,项目名称:WurmApi,代码行数:17,代码来源:WurmConfigDirectoriesTests.cs


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