public LengthBetweenData() { int[] emptyArr = new int[0], arr = { 1, 2, 3 }; var list = new List <int> { 1, 2, 3 }; var dict = new Dictionary <int, bool> { { 1, false }, { 2, true } }; var ft = new FakeType { Fourth = new[] { 1, 2, 3 } }; var ift = new InterFakeType(); AddValid("", 0, 0) .Result("LengthBetweenSpecification<String>") .NegationResult("NotLengthBetweenSpecification<String>+Failed", c => c .FailedSpecification(typeof(LengthBetweenSpecification <string>), "Object length is between [0] and [0]") .Candidate("") .AddParameter("MinLength", 0) .AddParameter("MaxLength", 0)); AddValid("test", 1, 4) .Result("LengthBetweenSpecification<String>") .NegationResult("NotLengthBetweenSpecification<String>+Failed", c => c .FailedSpecification(typeof(LengthBetweenSpecification <string>), "Object length is between [1] and [4]") .Candidate("test") .AddParameter("MinLength", 1) .AddParameter("MaxLength", 4)); AddValid(emptyArr, 0, 0) .Result("LengthBetweenSpecification<Int32[]>") .NegationResult("NotLengthBetweenSpecification<Int32[]>+Failed", c => c .FailedSpecification(typeof(LengthBetweenSpecification <int[]>), "Object length is between [0] and [0]") .Candidate(emptyArr) .AddParameter("MinLength", 0) .AddParameter("MaxLength", 0)); AddValid(arr, 2, 3) .Result("LengthBetweenSpecification<Int32[]>") .NegationResult("NotLengthBetweenSpecification<Int32[]>+Failed", c => c .FailedSpecification(typeof(LengthBetweenSpecification <int[]>), "Object length is between [2] and [3]") .Candidate(arr) .AddParameter("MinLength", 2) .AddParameter("MaxLength", 3)); AddValid(list, -1, 10) .Result("LengthBetweenSpecification<List<Int32>>") .NegationResult("NotLengthBetweenSpecification<List<Int32>>+Failed", c => c .FailedSpecification(typeof(LengthBetweenSpecification <List <int> >), "Object length is between [-1] and [10]") .Candidate(list) .AddParameter("MinLength", -1) .AddParameter("MaxLength", 10)); AddValid(dict, 0, 5) .Result("LengthBetweenSpecification<Dictionary<Int32,Boolean>>") .NegationResult("NotLengthBetweenSpecification<Dictionary<Int32,Boolean>>+Failed", c => c .FailedSpecification(typeof(LengthBetweenSpecification <Dictionary <int, bool> >), "Object length is between [0] and [5]") .Candidate(dict) .AddParameter("MinLength", 0) .AddParameter("MaxLength", 5)); AddValid(ft, 0, 3) .Result("LengthBetweenSpecification<FakeType>") .NegationResult("NotLengthBetweenSpecification<FakeType>+Failed", c => c .FailedSpecification(typeof(LengthBetweenSpecification <FakeType>), "Object length is between [0] and [3]") .Candidate(ft) .AddParameter("MinLength", 0) .AddParameter("MaxLength", 3)); AddValid(ift, 1, 1) .Result("LengthBetweenSpecification<InterFakeType>") .NegationResult("NotLengthBetweenSpecification<InterFakeType>+Failed", c => c .FailedSpecification(typeof(LengthBetweenSpecification <InterFakeType>), "Object length is between [1] and [1]") .Candidate(ift) .AddParameter("MinLength", 1) .AddParameter("MaxLength", 1)); AddInvalid("", 1, 10) .NegationResult("NotLengthBetweenSpecification<String>") .Result("LengthBetweenSpecification<String>+Failed", c => c .FailedSpecification(typeof(LengthBetweenSpecification <string>), "Object length is not between [1] and [10]") .Candidate("") .AddParameter("MinLength", 1) .AddParameter("MaxLength", 10)); AddInvalid("test", 10, 20) .NegationResult("NotLengthBetweenSpecification<String>") .Result("LengthBetweenSpecification<String>+Failed", c => c .FailedSpecification(typeof(LengthBetweenSpecification <string>), "Object length is not between [10] and [20]") .Candidate("test") .AddParameter("MinLength", 10) .AddParameter("MaxLength", 20)); AddInvalid(emptyArr, 1, 2) .NegationResult("NotLengthBetweenSpecification<Int32[]>") .Result("LengthBetweenSpecification<Int32[]>+Failed", c => c .FailedSpecification(typeof(LengthBetweenSpecification <int[]>), "Object length is not between [1] and [2]") .Candidate(emptyArr) .AddParameter("MinLength", 1) .AddParameter("MaxLength", 2)); AddInvalid(arr, -5, -1) .NegationResult("NotLengthBetweenSpecification<Int32[]>") .Result("LengthBetweenSpecification<Int32[]>+Failed", c => c .FailedSpecification(typeof(LengthBetweenSpecification <int[]>), "Object length is not between [-5] and [-1]") .Candidate(arr) .AddParameter("MinLength", -5) .AddParameter("MaxLength", -1)); AddInvalid(list, 0, 1) .NegationResult("NotLengthBetweenSpecification<List<Int32>>") .Result("LengthBetweenSpecification<List<Int32>>+Failed", c => c .FailedSpecification(typeof(LengthBetweenSpecification <List <int> >), "Object length is not between [0] and [1]") .Candidate(list) .AddParameter("MinLength", 0) .AddParameter("MaxLength", 1)); AddInvalid(dict, 0, 1) .NegationResult("NotLengthBetweenSpecification<Dictionary<Int32,Boolean>>") .Result("LengthBetweenSpecification<Dictionary<Int32,Boolean>>+Failed", c => c .FailedSpecification(typeof(LengthBetweenSpecification <Dictionary <int, bool> >), "Object length is not between [0] and [1]") .Candidate(dict) .AddParameter("MinLength", 0) .AddParameter("MaxLength", 1)); AddInvalid(ft, 4, 6) .NegationResult("NotLengthBetweenSpecification<FakeType>") .Result("LengthBetweenSpecification<FakeType>+Failed", c => c .FailedSpecification(typeof(LengthBetweenSpecification <FakeType>), "Object length is not between [4] and [6]") .Candidate(ft) .AddParameter("MinLength", 4) .AddParameter("MaxLength", 6)); AddInvalid(ift, 4, 6) .NegationResult("NotLengthBetweenSpecification<InterFakeType>") .Result("LengthBetweenSpecification<InterFakeType>+Failed", c => c .FailedSpecification(typeof(LengthBetweenSpecification <InterFakeType>), "Object length is not between [4] and [6]") .Candidate(ift) .AddParameter("MinLength", 4) .AddParameter("MaxLength", 6)); AddInvalid("null", 0, 1) .NegationResult("NotLengthBetweenSpecification<String>") .Result("LengthBetweenSpecification<String>+Failed", c => c .FailedSpecification(typeof(LengthBetweenSpecification <string>), "Object length is not between [0] and [1]") .Candidate(null) .AddParameter("MinLength", 0) .AddParameter("MaxLength", 1)); AddInvalid(new FakeType { Second = "null" }, 0, 0) .NegationResult("NotLengthBetweenSpecification<FakeType>") .Result("LengthBetweenSpecification<FakeType>+Failed", c => c .FailedSpecification(typeof(LengthBetweenSpecification <FakeType>), "Object length is not between [0] and [0]") .Candidate(null) .AddParameter("MinLength", 0) .AddParameter("MaxLength", 0)); }
public MinLengthData() { int[] emptyArr = new int[0], arr = { 1, 2, 3 }; var list = new List <int> { 1, 2, 3 }; var dict = new Dictionary <int, bool> { { 1, false }, { 2, true } }; var ft = new FakeType { Fourth = new[] { 1, 2, 3 } }; var ift = new InterFakeType(); AddValid("", 0) .Result("MinLengthSpecification<String>") .NegationResult("NotMinLengthSpecification<String>+Failed", c => c .FailedSpecification(typeof(MinLengthSpecification <string>), "Object length is greater than [0]") .Candidate("") .AddParameter("MinLength", 0)); AddValid("test", 4) .Result("MinLengthSpecification<String>") .NegationResult("NotMinLengthSpecification<String>+Failed", c => c .FailedSpecification(typeof(MinLengthSpecification <string>), "Object length is greater than [4]") .Candidate("test") .AddParameter("MinLength", 4)); AddValid(emptyArr, 0) .Result("MinLengthSpecification<Int32[]>") .NegationResult("NotMinLengthSpecification<Int32[]>+Failed", c => c .FailedSpecification(typeof(MinLengthSpecification <int[]>), "Object length is greater than [0]") .Candidate(emptyArr) .AddParameter("MinLength", 0)); AddValid(arr, 1) .Result("MinLengthSpecification<Int32[]>") .NegationResult("NotMinLengthSpecification<Int32[]>+Failed", c => c .FailedSpecification(typeof(MinLengthSpecification <int[]>), "Object length is greater than [1]") .Candidate(arr) .AddParameter("MinLength", 1)); AddValid(list, 3) .Result("MinLengthSpecification<List<Int32>>") .NegationResult("NotMinLengthSpecification<List<Int32>>+Failed", c => c .FailedSpecification(typeof(MinLengthSpecification <List <int> >), "Object length is greater than [3]") .Candidate(list) .AddParameter("MinLength", 3)); AddValid(dict, 2) .Result("MinLengthSpecification<Dictionary<Int32,Boolean>>") .NegationResult("NotMinLengthSpecification<Dictionary<Int32,Boolean>>+Failed", c => c .FailedSpecification(typeof(MinLengthSpecification <Dictionary <int, bool> >), "Object length is greater than [2]") .Candidate(dict) .AddParameter("MinLength", 2)); AddValid(ft, 2) .Result("MinLengthSpecification<FakeType>") .NegationResult("NotMinLengthSpecification<FakeType>+Failed", c => c .FailedSpecification(typeof(MinLengthSpecification <FakeType>), "Object length is greater than [2]") .Candidate(ft) .AddParameter("MinLength", 2)); AddValid(ift, 0) .Result("MinLengthSpecification<InterFakeType>") .NegationResult("NotMinLengthSpecification<InterFakeType>+Failed", c => c .FailedSpecification(typeof(MinLengthSpecification <InterFakeType>), "Object length is greater than [0]") .Candidate(ift) .AddParameter("MinLength", 0)); AddInvalid("", 1) .NegationResult("NotMinLengthSpecification<String>") .Result("MinLengthSpecification<String>+Failed", c => c .FailedSpecification(typeof(MinLengthSpecification <string>), "Object length is lower than [1]") .Candidate("") .AddParameter("MinLength", 1)); AddInvalid("test", 10) .NegationResult("NotMinLengthSpecification<String>") .Result("MinLengthSpecification<String>+Failed", c => c .FailedSpecification(typeof(MinLengthSpecification <string>), "Object length is lower than [10]") .Candidate("test") .AddParameter("MinLength", 10)); AddInvalid(emptyArr, 1) .NegationResult("NotMinLengthSpecification<Int32[]>") .Result("MinLengthSpecification<Int32[]>+Failed", c => c .FailedSpecification(typeof(MinLengthSpecification <int[]>), "Object length is lower than [1]") .Candidate(emptyArr) .AddParameter("MinLength", 1)); AddInvalid(arr, 20) .NegationResult("NotMinLengthSpecification<Int32[]>") .Result("MinLengthSpecification<Int32[]>+Failed", c => c .FailedSpecification(typeof(MinLengthSpecification <int[]>), "Object length is lower than [20]") .Candidate(arr) .AddParameter("MinLength", 20)); AddInvalid(list, 4) .NegationResult("NotMinLengthSpecification<List<Int32>>") .Result("MinLengthSpecification<List<Int32>>+Failed", c => c .FailedSpecification(typeof(MinLengthSpecification <List <int> >), "Object length is lower than [4]") .Candidate(list) .AddParameter("MinLength", 4)); AddInvalid(dict, 5) .NegationResult("NotMinLengthSpecification<Dictionary<Int32,Boolean>>") .Result("MinLengthSpecification<Dictionary<Int32,Boolean>>+Failed", c => c .FailedSpecification(typeof(MinLengthSpecification <Dictionary <int, bool> >), "Object length is lower than [5]") .Candidate(dict) .AddParameter("MinLength", 5)); AddInvalid(ft, 5) .NegationResult("NotMinLengthSpecification<FakeType>") .Result("MinLengthSpecification<FakeType>+Failed", c => c .FailedSpecification(typeof(MinLengthSpecification <FakeType>), "Object length is lower than [5]") .Candidate(ft) .AddParameter("MinLength", 5)); AddInvalid(ift, 2) .NegationResult("NotMinLengthSpecification<InterFakeType>") .Result("MinLengthSpecification<InterFakeType>+Failed", c => c .FailedSpecification(typeof(MinLengthSpecification <InterFakeType>), "Object length is lower than [2]") .Candidate(ift) .AddParameter("MinLength", 2)); AddInvalid("null", 1) .NegationResult("NotMinLengthSpecification<String>") .Result("MinLengthSpecification<String>+Failed", c => c .FailedSpecification(typeof(MinLengthSpecification <string>), "Object length is lower than [1]") .Candidate(null) .AddParameter("MinLength", 1)); AddInvalid(new FakeType { Second = "null" }, 0) .NegationResult("NotMinLengthSpecification<FakeType>") .Result("MinLengthSpecification<FakeType>+Failed", c => c .FailedSpecification(typeof(MinLengthSpecification <FakeType>), "Object length is lower than [0]") .Candidate(null) .AddParameter("MinLength", 0)); }