Example #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void testDurationWithValueNotWithinConstraint()
        internal virtual void TestDurationWithValueNotWithinConstraint()
        {
            Setting <Duration> setting = buildSetting("foo.bar", DURATION, "3s").constraint(min(DURATION.apply("3s"))).build();

            assertThrows(typeof(InvalidSettingException), () => setting.apply(Map(stringMap("foo.bar", "2s"))));
        }
Example #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void testDuration()
        internal virtual void TestDuration()
        {
            Setting <Duration> setting = buildSetting("foo.bar", DURATION, "3s").constraint(min(DURATION.apply("3s"))).build();

            assertThat(setting.apply(Map(stringMap("foo.bar", "4s"))), equalTo(Duration.ofSeconds(4)));
        }
Example #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void testDurationWithBrokenDefault()
        internal virtual void TestDurationWithBrokenDefault()
        {
            // Notice that the default value is less that the minimum
            Setting <Duration> setting = buildSetting("foo.bar", DURATION, "1s").constraint(min(DURATION.apply("3s"))).build();

            assertThrows(typeof(InvalidSettingException), () => setting.apply(Map(stringMap())));
        }