public void Should_Initialize() { var arg = Arg.Enum("name", StringComparison.CurrentCulture); Assert.Equal("name", arg.Name); Assert.Equal("format", arg.AllowedParameters.Single()); }
public void Should_StringifyDefaultValues() { IArg arg = Arg.Enum("name", StringComparison.CurrentCulture); arg.Name.Should().Be("name"); arg.ToString(null).Should().Be("CurrentCulture"); }
public void Should_StringifyDefaultValues() { var arg = Arg.Enum("name", StringComparison.CurrentCulture); Assert.Equal("name", arg.Name); Assert.Equal("CurrentCulture", arg.ToString(null)); }
public void NotContains_Should_CollectError(string model, string argValue, StringComparison stringComparison, bool shouldBeValid) { Tester.TestSingleRule( model, m => m.NotContains(argValue, stringComparison), shouldBeValid, MessageKey.Texts.NotContains, Arg.Text("value", argValue), Arg.Enum("stringComparison", stringComparison)); }
public void NotEqualTo_Should_CollectError_When_TimeComparisonSet(DateTimeOffset model, DateTimeOffset value, TimeComparison timeComparison, bool shouldBeValid) { Tester.TestSingleRule( model, m => m.NotEqualTo(value, timeComparison), shouldBeValid, MessageKey.Times.NotEqualTo, Arg.Time("value", value), Arg.Enum("timeComparison", timeComparison)); }
public void NotEqualTo_Should_CollectError_FromNullable(DateTimeOffset model, DateTimeOffset value, bool shouldBeValid) { Tester.TestSingleRule <DateTimeOffset?>( model, m => m.NotEqualTo(value), shouldBeValid, MessageKey.Times.NotEqualTo, Arg.Time("value", value), Arg.Enum("timeComparison", TimeComparison.All)); }
public void After_Should_CollectError(DateTimeOffset model, DateTimeOffset min, bool shouldBeValid) { Tester.TestSingleRule( model, m => m.After(min), shouldBeValid, MessageKey.Times.After, Arg.Time("min", min), Arg.Enum("timeComparison", TimeComparison.All)); }
public void BeforeOrEqualTo_Should_CollectError(DateTimeOffset model, DateTimeOffset max, bool shouldBeValid) { Tester.TestSingleRule( model, m => m.BeforeOrEqualTo(max), shouldBeValid, MessageKey.Times.BeforeOrEqualTo, Arg.Time("max", max), Arg.Enum("timeComparison", TimeComparison.All)); }
public void AfterOrEqualTo_Should_CollectError_FromNullable(DateTimeOffset model, DateTimeOffset min, bool shouldBeValid) { Tester.TestSingleRule <DateTimeOffset?>( model, m => m.AfterOrEqualTo(min), shouldBeValid, MessageKey.Times.AfterOrEqualTo, Arg.Time("min", min), Arg.Enum("timeComparison", TimeComparison.All)); }
public void Before_Should_CollectError_FromNullable(DateTimeOffset model, DateTimeOffset max, bool shouldBeValid) { Tester.TestSingleRule <DateTimeOffset?>( model, m => m.Before(max), shouldBeValid, MessageKey.Times.Before, Arg.Time("max", max), Arg.Enum("timeComparison", TimeComparison.All)); }
public void BeforeOrEqualTo_Should_CollectError_When_TimeComparisonSet_FromNullable(DateTimeOffset model, DateTimeOffset max, TimeComparison timeComparison, bool shouldBeValid) { Tester.TestSingleRule <DateTimeOffset?>( model, m => m.BeforeOrEqualTo(max, timeComparison), shouldBeValid, MessageKey.Times.BeforeOrEqualTo, Arg.Time("max", max), Arg.Enum("timeComparison", timeComparison)); }
public void AfterOrEqualTo_Should_CollectError_When_TimeComparisonSet(DateTimeOffset model, DateTimeOffset min, TimeComparison timeComparison, bool shouldBeValid) { Tester.TestSingleRule( model, m => m.AfterOrEqualTo(min, timeComparison), shouldBeValid, MessageKey.Times.AfterOrEqualTo, Arg.Time("min", min), Arg.Enum("timeComparison", timeComparison)); }
public void EqualTo_Should_CollectError(DateTime model, DateTime value, bool shouldBeValid) { Tester.TestSingleRule( model, m => m.EqualTo(value), shouldBeValid, MessageKey.Times.EqualTo, Arg.Time("value", value), Arg.Enum("timeComparison", TimeComparison.All)); }
public void EndsWith_Should_CollectError(string model, string value, StringComparison stringComparison, bool shouldBeValid) { Tester.TestSingleRule( model, m => m.EndsWith(value, stringComparison), shouldBeValid, MessageKey.Texts.EndsWith, Arg.Text("value", value), Arg.Enum("stringComparison", stringComparison)); }
public void NotEqualTo_Should_CollectError_When_ComparisonIgnoreCase(string model, string value, bool shouldBeValid) { Tester.TestSingleRule( model, m => m.NotEqualTo(value, StringComparison.OrdinalIgnoreCase), shouldBeValid, MessageKey.Texts.NotEqualTo, Arg.Text("value", value), Arg.Enum("stringComparison", StringComparison.OrdinalIgnoreCase)); }
public void After_Should_CollectError_When_TimeComparisonSet_FromNullable(DateTimeOffset model, DateTimeOffset min, TimeComparison timeComparison, bool shouldBeValid) { Tester.TestSingleRule <DateTimeOffset?>( model, m => m.After(min, timeComparison), shouldBeValid, MessageKey.Times.After, Arg.Time("min", min), Arg.Enum("timeComparison", timeComparison)); }
public void Before_Should_CollectError_When_TimeComparisonSet(DateTime model, DateTime max, TimeComparison timeComparison, bool shouldBeValid) { Tester.TestSingleRule( model, m => m.Before(max, timeComparison), shouldBeValid, MessageKey.Times.Before, Arg.Time("max", max), Arg.Enum("timeComparison", timeComparison)); }
public void EqualTo_Should_CollectError_When_TimeComparisonSet_FromNullable(DateTime model, DateTime value, TimeComparison timeComparison, bool shouldBeValid) { Tester.TestSingleRule <DateTime?>( model, m => m.EqualTo(value, timeComparison), shouldBeValid, MessageKey.Times.EqualTo, Arg.Time("value", value), Arg.Enum("timeComparison", timeComparison)); }
public void Should_StringifyUsingTranslation_When_BothFormatAndTranslationPresent() { IArg arg1 = Arg.Enum("name", StringComparison.CurrentCulture); var stringified1 = arg1.ToString(new Dictionary <string, string> { ["format"] = "D", ["translation"] = "true" }); stringified1.Should().Be("{_translation|key=Enum.System.StringComparison.CurrentCulture}"); }
public void Between_Should_CollectError(DateTimeOffset min, DateTimeOffset model, DateTimeOffset max, bool shouldBeValid) { Tester.TestSingleRule( model, m => m.Between(min, max), shouldBeValid, MessageKey.Times.Between, Arg.Time("min", min), Arg.Time("max", max), Arg.Enum("timeComparison", TimeComparison.All)); }
public void Should_Stringify_UsingFormat(StringComparison stringComparison, string format, string expectedString) { IArg arg = Arg.Enum("name", stringComparison); var stringified = arg.ToString(new Dictionary <string, string> { ["format"] = format }); stringified.Should().Be(expectedString); }
public void Between_Should_CollectError_When_TimeComparisonSet_FromNullable(DateTime min, DateTime model, DateTime max, TimeComparison timeComparison, bool shouldBeValid) { Tester.TestSingleRule <DateTime?>( model, m => m.Between(min, max, timeComparison), shouldBeValid, MessageKey.Times.Between, Arg.Time("min", min), Arg.Time("max", max), Arg.Enum("timeComparison", timeComparison)); }
public void BetweenOrEqualTo_Should_CollectError_FromNullable(DateTime min, DateTime model, DateTime max, bool shouldBeValid) { Tester.TestSingleRule <DateTime?>( model, m => m.BetweenOrEqualTo(min, max), shouldBeValid, MessageKey.Times.BetweenOrEqualTo, Arg.Time("min", min), Arg.Time("max", max), Arg.Enum("timeComparison", TimeComparison.All)); }
public void Should_Stringify(StringComparison stringComparison, string format, string expectedString) { var arg = Arg.Enum("name", stringComparison); var stringified = arg.ToString(new Dictionary <string, string> { { "format", format } }); Assert.Equal(expectedString, stringified); }
public void After_Should_CollectError_When_TimeComparisonSet(DateTime memberValue, DateTime min, TimeComparison timeComparison, bool expectedIsValid) { Tester.TestSingleMemberRule <DateTime?>( m => m.After(min, timeComparison), memberValue, expectedIsValid, Phrases.Keys.Times.After, new[] { Arg.Time("min", min), Arg.Enum("timeComparison", timeComparison) }); }
public void BeforeOrEqualTo_Should_CollectError_When_TimeComparisonSet(DateTime memberValue, DateTime max, TimeComparison timeComparison, bool expectedIsValid) { Tester.TestSingleMemberRule <DateTime?>( m => m.BeforeOrEqualTo(max, timeComparison), memberValue, expectedIsValid, Phrases.Keys.Times.BeforeOrEqualTo, new[] { Arg.Time("max", max), Arg.Enum("timeComparison", timeComparison) }); }
public void NotContains_Should_CollectError(string memberValue, string argValue, StringComparison stringComparison, bool expectedIsValid) { Tester.TestSingleMemberRule( m => m.NotContains(argValue, stringComparison), memberValue, expectedIsValid, Phrases.Keys.Texts.NotContains, new[] { Arg.Text("value", argValue), Arg.Enum("stringComparison", stringComparison) }); }
public void AfterOrEqualTo_Should_CollectError(DateTime memberValue, DateTime min, bool expectedIsValid) { Tester.TestSingleMemberRule <DateTime?>( m => m.AfterOrEqualTo(min), memberValue, expectedIsValid, Phrases.Keys.Times.AfterOrEqualTo, new[] { Arg.Time("min", min), Arg.Enum("timeComparison", TimeComparison.All) }); }
public void EqualTo_Should_CollectError_When_ComparisonIgnoreCase(string memberValue, string argValue, bool expectedIsValid) { Tester.TestSingleMemberRule( m => m.EqualTo(argValue, StringComparison.OrdinalIgnoreCase), memberValue, expectedIsValid, Phrases.Keys.Texts.EqualTo, new[] { Arg.Text("value", argValue), Arg.Enum("stringComparison", StringComparison.OrdinalIgnoreCase) }); }
public void NotEqualTo_Should_CollectError(DateTime memberValue, DateTime value, bool expectedIsValid) { Tester.TestSingleMemberRule <DateTime?>( m => m.NotEqualTo(value), memberValue, expectedIsValid, Phrases.Keys.Times.NotEqualTo, new[] { Arg.Time("value", value), Arg.Enum("timeComparison", TimeComparison.All) }); }