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


C# ReadPreference.With方法代码示例

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


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

示例1: With_tagSets_should_return_expected_result

        public void With_tagSets_should_return_expected_result()
        {
            var tagSets1 = new[] { new TagSet(new[] { new Tag("name", "value1") }) };
            var tagSets2 = new[] { new TagSet(new[] { new Tag("name", "value2") }) };
            var subject = new ReadPreference(ReadPreferenceMode.Secondary, tagSets1);

            var result = subject.With(tagSets: tagSets2);

            result.ReadPreferenceMode.Should().Be(subject.ReadPreferenceMode);
            result.TagSets.Should().Equal(tagSets2);
        }
开发者ID:narutoswj,项目名称:mongo-csharp-driver,代码行数:11,代码来源:ReadPreferenceTests.cs

示例2: With_mode_should_return_expected_result

        public void With_mode_should_return_expected_result()
        {
            var mode1 = ReadPreferenceMode.Secondary;
            var mode2 = ReadPreferenceMode.SecondaryPreferred;
            var subject = new ReadPreference(mode1);

            var result = subject.With(mode: mode2);

            result.ReadPreferenceMode.Should().Be(mode2);
            result.TagSets.Should().Equal(subject.TagSets);
        }
开发者ID:narutoswj,项目名称:mongo-csharp-driver,代码行数:11,代码来源:ReadPreferenceTests.cs

示例3: With_mode_should_return_expected_result

        public void With_mode_should_return_expected_result(
            [Values(ReadPreferenceMode.Primary, ReadPreferenceMode.Secondary)]
            ReadPreferenceMode originalMode,
            [Values(ReadPreferenceMode.Primary, ReadPreferenceMode.Secondary)]
            ReadPreferenceMode mode)
        {
            var subject = new ReadPreference(originalMode);

            var result = subject.With(mode);

            result.ReadPreferenceMode.Should().Be(mode);
            result.With(originalMode).Should().Be(subject);
        }
开发者ID:mfidemraizer,项目名称:mongo-csharp-driver,代码行数:13,代码来源:ReadPreferenceTests.cs

示例4: With_tagSets_should_return_expected_result

        public void With_tagSets_should_return_expected_result(
            [Values("a", "b")]
            string originalTagValue,
            [Values("a", "b")]
            string tagValue)
        {
            var originalTagSets = new[] { new TagSet(new[] { new Tag("x", originalTagValue) }) };
            var tagSets = new[] { new TagSet(new[] { new Tag("x", tagValue) }) };
            var subject = new ReadPreference(ReadPreferenceMode.Secondary, tagSets: originalTagSets);

            var result = subject.With(tagSets);

            result.TagSets.Should().Equal(tagSets);
            result.With(originalTagSets).Should().Be(subject);
        }
开发者ID:mfidemraizer,项目名称:mongo-csharp-driver,代码行数:15,代码来源:ReadPreferenceTests.cs

示例5: With_maxStaleness_should_return_expected_result

        public void With_maxStaleness_should_return_expected_result(
            [Values(1, 2)]
            int originalSeconds,
            [Values(1, 2)]
            int seconds)
        {
            var originalMaxStaleness = TimeSpan.FromSeconds(originalSeconds);
            var maxStaleness = TimeSpan.FromSeconds(seconds);
            var subject = new ReadPreference(ReadPreferenceMode.Secondary, maxStaleness: originalMaxStaleness);

            var result = subject.With(maxStaleness);

            result.MaxStaleness.Should().Be(maxStaleness);
            result.With(originalMaxStaleness).Should().Be(subject);
        }
开发者ID:mfidemraizer,项目名称:mongo-csharp-driver,代码行数:15,代码来源:ReadPreferenceTests.cs


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