Skip to content

Commit e68d75a

Browse files
committed
Valid cases checks
1 parent 9ca8ebd commit e68d75a

File tree

1 file changed

+67
-7
lines changed

1 file changed

+67
-7
lines changed

Orm/Xtensive.Orm.Tests/Storage/IngoreRulesConfigureTest.cs

Lines changed: 67 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,85 @@ public void CheckColumnOrIndexDeclaredTest()
2929
const string SomeColumn = "SomeColumn";
3030
const string SomeIndex = "SomeIndex";
3131

32-
var invalidFactories = new TestDelegate[] {
32+
var invalidCases = new TestDelegate[] {
3333
() => new IgnoreRule(SomeDB, SomeSchema, SomeTable, SomeColumn, SomeIndex),
3434
() => new IgnoreRule("", SomeSchema, SomeTable, SomeColumn, SomeIndex),
3535
() => new IgnoreRule(SomeDB, "", SomeTable, SomeColumn, SomeIndex),
3636
() => new IgnoreRule(SomeDB, SomeSchema, "", SomeColumn, SomeIndex),
3737
() => new IgnoreRule("", "", SomeTable, SomeColumn, SomeIndex),
3838
() => new IgnoreRule(SomeDB, "", "", SomeColumn, SomeIndex),
3939
() => new IgnoreRule("", SomeSchema, "", SomeColumn, SomeIndex),
40-
() => new IgnoreRule("", "", "", SomeColumn, SomeIndex)
40+
() => new IgnoreRule("", "", "", SomeColumn, SomeIndex),
41+
42+
() => new IgnoreRule() { Table = SomeTable, Column = SomeColumn, Index = SomeIndex },
43+
() => new IgnoreRule() { Table = SomeTable, Index = SomeIndex, Column = SomeColumn }
4144
};
4245

43-
foreach (var func in invalidFactories) {
46+
foreach (var func in invalidCases) {
4447
_ = Assert.Throws<InvalidOperationException>(func);
4548
}
49+
}
50+
51+
[Test]
52+
public void ValidRules()
53+
{
54+
const string SomeDB = "SomeDB";
55+
const string SomeSchema = "SomeSchema";
56+
const string SomeTable = "SomeTable";
57+
const string SomeColumn = "SomeColumn";
58+
const string SomeIndex = "SomeIndex";
4659

47-
_ = Assert.Throws<InvalidOperationException>(
48-
() => new IgnoreRule() { Table = SomeTable, Column = SomeColumn, Index = SomeIndex, });
49-
_ = Assert.Throws<InvalidOperationException>(
50-
() => new IgnoreRule() { Table = SomeTable, Index = SomeIndex, Column = SomeColumn, });
60+
var validCases = new TestDelegate[] {
61+
() => new IgnoreRule(SomeDB, SomeSchema, SomeTable, null, SomeIndex),
62+
() => new IgnoreRule(SomeDB, SomeSchema, SomeTable, SomeColumn, null),
63+
64+
() => new IgnoreRule(SomeDB, SomeSchema, SomeTable, "", SomeIndex),
65+
() => new IgnoreRule(SomeDB, SomeSchema, SomeTable, SomeColumn, ""),
66+
67+
() => new IgnoreRule("", SomeSchema, SomeTable, "", SomeIndex),
68+
() => new IgnoreRule(SomeDB, "", SomeTable, "", SomeIndex),
69+
() => new IgnoreRule(SomeDB, SomeSchema, "", "", SomeIndex),
70+
() => new IgnoreRule("", "", SomeTable, "", SomeIndex),
71+
() => new IgnoreRule(SomeDB, "", "", "", SomeIndex),
72+
() => new IgnoreRule("", SomeSchema, "", "", SomeIndex),
73+
() => new IgnoreRule("", "", "", "", SomeIndex),
74+
75+
() => new IgnoreRule(null, SomeSchema, SomeTable, null, SomeIndex),
76+
() => new IgnoreRule(SomeDB, null, SomeTable, null, SomeIndex),
77+
() => new IgnoreRule(SomeDB, SomeSchema, null, null, SomeIndex),
78+
() => new IgnoreRule(null, null, SomeTable, null, SomeIndex),
79+
() => new IgnoreRule(SomeDB, null, null, null, SomeIndex),
80+
() => new IgnoreRule(null, SomeSchema, null, null, SomeIndex),
81+
() => new IgnoreRule(null, null, null, null, SomeIndex),
82+
83+
() => new IgnoreRule("", SomeSchema, SomeTable, SomeTable, ""),
84+
() => new IgnoreRule(SomeDB, "", SomeTable, SomeTable, ""),
85+
() => new IgnoreRule(SomeDB, SomeSchema, "", SomeTable, ""),
86+
() => new IgnoreRule("", "", SomeTable, SomeTable, ""),
87+
() => new IgnoreRule(SomeDB, "", "", SomeTable, ""),
88+
() => new IgnoreRule("", SomeSchema, "", SomeTable, ""),
89+
() => new IgnoreRule("", "", "", SomeTable, ""),
90+
91+
() => new IgnoreRule(null, SomeSchema, SomeTable, SomeTable, null),
92+
() => new IgnoreRule(SomeDB, null, SomeTable, SomeTable, null),
93+
() => new IgnoreRule(SomeDB, SomeSchema, null, SomeTable, null),
94+
() => new IgnoreRule(null, null, SomeTable, SomeTable, null),
95+
() => new IgnoreRule(SomeDB, null, null, SomeTable, null),
96+
() => new IgnoreRule(null, SomeSchema, null, SomeTable, null),
97+
() => new IgnoreRule(null, null, null, SomeTable, null),
98+
99+
() => new IgnoreRule("", SomeSchema, SomeTable, "", ""),
100+
() => new IgnoreRule(SomeDB, "", SomeTable, "", ""),
101+
() => new IgnoreRule("", "", SomeTable, "", ""),
102+
103+
() => new IgnoreRule(null, SomeSchema, SomeTable, null, null),
104+
() => new IgnoreRule(SomeDB, null, SomeTable, null, null),
105+
() => new IgnoreRule(null, null, SomeTable, null, null),
106+
};
107+
108+
foreach (var func in validCases) {
109+
Assert.DoesNotThrow(func);
110+
}
51111
}
52112
}
53113
}

0 commit comments

Comments
 (0)