|
4 | 4 | using FluentNHibernate.MappingModel;
|
5 | 5 | using FluentNHibernate.MappingModel.ClassBased;
|
6 | 6 | using FluentNHibernate.MappingModel.Collections;
|
7 |
| -using FluentNHibernate.Utils; |
8 | 7 | using FluentNHibernate.Visitors;
|
9 | 8 | using NUnit.Framework;
|
10 | 9 |
|
@@ -45,9 +44,9 @@ public override void because()
|
45 | 44 | [Test]
|
46 | 45 | public void should_prefix_property_columns()
|
47 | 46 | {
|
48 |
| - target_mapping.Components.Single() |
49 |
| - .Properties.SelectMany(x => x.Columns) |
50 |
| - .Each(x => x.Name.ShouldStartWith("Component_")); |
| 47 | + var columns = target_mapping.Components.Single() |
| 48 | + .Properties.SelectMany(x => x.Columns); |
| 49 | + Assert.That(columns, Has.All.Property("Name").StartWith("Component_")); |
51 | 50 | }
|
52 | 51 | }
|
53 | 52 |
|
@@ -94,11 +93,11 @@ public override void because()
|
94 | 93 | [Test]
|
95 | 94 | public void should_prefix_sub_component_columns_with_both_prefixes()
|
96 | 95 | {
|
97 |
| - target_mapping |
| 96 | + var columns = target_mapping |
98 | 97 | .Components.Single()
|
99 | 98 | .Components.Single()
|
100 |
| - .Properties.SelectMany(x => x.Columns) |
101 |
| - .Each(x => x.Name.ShouldStartWith(first_prefix + second_prefix)); |
| 99 | + .Properties.SelectMany(x => x.Columns); |
| 100 | + Assert.That(columns, Has.All.Property("Name").StartWith(first_prefix + second_prefix)); |
102 | 101 | }
|
103 | 102 | }
|
104 | 103 |
|
@@ -133,8 +132,8 @@ public override void because()
|
133 | 132 | [Test]
|
134 | 133 | public void shouldnt_use_the_original_prefix()
|
135 | 134 | {
|
136 |
| - reference_without_a_prefix.Properties.SelectMany(x => x.Columns) |
137 |
| - .Each(x => x.Name.ShouldNotStartWith(column_prefix)); |
| 135 | + var columns = reference_without_a_prefix.Properties.SelectMany(x => x.Columns); |
| 136 | + Assert.That(columns, Has.None.Property("Name").StartWith(column_prefix)); |
138 | 137 | }
|
139 | 138 | }
|
140 | 139 |
|
@@ -175,31 +174,31 @@ public override void because()
|
175 | 174 | [Test]
|
176 | 175 | public void should_prefix_collection_columns()
|
177 | 176 | {
|
178 |
| - target_mapping.Components.Single().Collections.ShouldHaveCount(1); |
179 |
| - target_mapping.Components.Single().Collections |
180 |
| - .SelectMany(x => x.Key.Columns) |
181 |
| - .Each(x => x.Name.ShouldStartWith(column_prefix)); |
| 177 | + Assert.That(target_mapping.Components.Single().Collections.Count(), Is.EqualTo(1)); |
| 178 | + var keyColumns = target_mapping.Components.Single().Collections |
| 179 | + .SelectMany(x => x.Key.Columns); |
| 180 | + Assert.That(keyColumns, Has.All.Property("Name").StartWith(column_prefix)); |
182 | 181 | }
|
183 | 182 |
|
184 | 183 | [Test]
|
185 | 184 | public void should_prefix_columns_inside_an_inner_component()
|
186 | 185 | {
|
187 | 186 | target_mapping.Components.ShouldHaveCount(1);
|
188 | 187 | target_mapping.Components.SelectMany(x => x.Components).ShouldHaveCount(1);
|
189 |
| - target_mapping.Components |
| 188 | + var columns = target_mapping.Components |
190 | 189 | .SelectMany(x => x.Components)
|
191 | 190 | .SelectMany(x => x.Properties)
|
192 |
| - .SelectMany(x => x.Columns) |
193 |
| - .Each(x => x.Name.ShouldStartWith(column_prefix)); |
| 191 | + .SelectMany(x => x.Columns); |
| 192 | + Assert.That(columns, Has.All.Property("Name").StartWith(column_prefix)); |
194 | 193 | }
|
195 | 194 |
|
196 | 195 | [Test]
|
197 | 196 | public void should_prefix_property_columns()
|
198 | 197 | {
|
199 | 198 | target_mapping.Components.Single().Properties.ShouldHaveCount(1);
|
200 |
| - target_mapping.Components.Single() |
201 |
| - .Properties.SelectMany(x => x.Columns) |
202 |
| - .Each(x => x.Name.ShouldStartWith(column_prefix)); |
| 199 | + var columns = target_mapping.Components.Single() |
| 200 | + .Properties.SelectMany(x => x.Columns); |
| 201 | + Assert.That(columns, Has.All.Property("Name").StartWith(column_prefix)); |
203 | 202 | }
|
204 | 203 | }
|
205 | 204 |
|
@@ -236,9 +235,8 @@ public override void because()
|
236 | 235 | [Test]
|
237 | 236 | public void should_prefix_field_columns()
|
238 | 237 | {
|
239 |
| - targetMapping.Components.Single() |
240 |
| - .Properties.SelectMany(x => x.Columns) |
241 |
| - .Each(c => c.Name.ShouldStartWith("component")); |
| 238 | + var columns = targetMapping.Components.Single().Properties.SelectMany(x => x.Columns); |
| 239 | + Assert.That(columns, Has.All.Property("Name").StartWith("component")); |
242 | 240 | }
|
243 | 241 | }
|
244 | 242 |
|
|
0 commit comments