Skip to content

Commit 9fab4c4

Browse files
authored
Replace FluentAssertions with Machine.Specifications.Should (#736)
+semver:patch
1 parent cb65863 commit 9fab4c4

38 files changed

+350
-395
lines changed

src/FluentNHibernate.Specs/Automapping/AutoMapBackwardsCompatibilitySpecs.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using FluentNHibernate.Automapping;
33
using FluentNHibernate.Specs.Automapping.Fixtures;
44
using Machine.Specifications;
5-
using FluentAssertions;
65

76
namespace FluentNHibernate.Specs.Automapping;
87
// just verify that the obsolete methods still work until we bin them entirely
@@ -14,7 +13,7 @@ public class when_using_automap_obsolete_where_method_for_assembly_of : AutoMapO
1413
.BuildMappings();
1514

1615
It should_use_the_where_clause_provided = () =>
17-
was_called.Should().BeTrue();
16+
was_called.ShouldBeTrue();
1817
}
1918

2019
public class when_using_automap_obsolete_where_method_for_an_assembly : AutoMapObsoleteSpec
@@ -24,7 +23,7 @@ public class when_using_automap_obsolete_where_method_for_an_assembly : AutoMapO
2423
.BuildMappings();
2524

2625
It should_use_the_where_clause_provided = () =>
27-
was_called.Should().BeTrue();
26+
was_called.ShouldBeTrue();
2827
}
2928

3029
public class when_using_automap_obsolete_where_method_for_a_source : AutoMapObsoleteSpec
@@ -34,7 +33,7 @@ public class when_using_automap_obsolete_where_method_for_a_source : AutoMapObso
3433
.BuildMappings();
3534

3635
It should_use_the_where_clause_provided = () =>
37-
was_called.Should().BeTrue();
36+
was_called.ShouldBeTrue();
3837
}
3938

4039
public abstract class AutoMapObsoleteSpec

src/FluentNHibernate.Specs/Automapping/AutoPersistenceModelSpecs.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
using FluentNHibernate.Specs.Automapping.Fixtures;
1010
using FluentNHibernate.Specs.ExternalFixtures;
1111
using Machine.Specifications;
12-
using FluentAssertions;
1312

1413
namespace FluentNHibernate.Specs.Automapping;
1514

@@ -57,7 +56,7 @@ public class when_the_automapper_is_ran_to_completion
5756
ex = Catch.Exception(() => setup.BuildConfiguration());
5857

5958
It should_generate_xml_that_is_accepted_by_the_nhibernate_schema_validation = () =>
60-
ex.Should().BeNull();
59+
ex.ShouldBeNull();
6160

6261
static FluentConfiguration setup;
6362
static Exception ex;
@@ -87,7 +86,7 @@ public class when_the_automapper_is_told_to_map_an_inheritance_hierarchy
8786
// that were already mapped in the child. Needed to change the
8887
// ordering so parents are always mapped before their children
8988
It should_map_the_top_most_class_first = () =>
90-
ex.Should().BeNull();
89+
ex.ShouldBeNull();
9190

9291
static Exception ex;
9392
}
@@ -103,11 +102,11 @@ public class when_the_automapper_maps_an_inheritance_hierarchy_with_three_levels
103102
.SelectMany(x => x.Classes);
104103

105104
It should_map_the_parent = () =>
106-
mappings.Count().Should().Be(1);
105+
mappings.Count().ShouldEqual(1);
107106

108107
It should_map_the_child_child_as_a_subclass_of_parent = () =>
109108
mappings.Single()
110-
.Subclasses.Single().Type.Should().Be(typeof(ChildChild));
109+
.Subclasses.Single().Type.ShouldEqual(typeof(ChildChild));
111110

112111
static AutoPersistenceModel mapper;
113112
static IEnumerable<ClassMapping> mappings;

src/FluentNHibernate.Specs/Automapping/AutomappingSpecs.Components.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using FluentNHibernate.Specs.ExternalFixtures;
99
using FluentNHibernate.Utils;
1010
using Machine.Specifications;
11-
using FluentAssertions;
1211

1312
namespace FluentNHibernate.Specs.Automapping;
1413

@@ -68,7 +67,7 @@ public class when_the_automapper_is_told_to_map_an_entity_and_a_component_that_h
6867
.Components.ShouldContain(x => x.Type == typeof(Component));
6968

7069
It should_use_the_component_map_for_mapping = () =>
71-
mappings.Single().Components.Single().Access.Should().Be("none");
70+
mappings.Single().Components.Single().Access.ShouldEqual("none");
7271

7372
static AutoPersistenceModel mapper;
7473
static IEnumerable<ClassMapping> mappings;
@@ -105,15 +104,15 @@ public class when_the_automapper_maps_nested_comonents
105104
.SelectMany(x => x.Properties)
106105
.SelectMany(x => x.Columns)
107106
.Select(x => x.Name)
108-
.Should().Contain(new string[] { "LeftLocationProperty", "RightLocationProperty" });
107+
.ShouldContain("LeftLocationProperty", "RightLocationProperty");
109108

110109
It should_prefix_the_components_in_the_components = () =>
111110
mapping.Components
112111
.SelectMany(x => x.Components)
113112
.SelectMany(x => x.Properties)
114113
.SelectMany(x => x.Columns)
115114
.Select(x => x.Name)
116-
.Should().Contain(new string[] { "LeftAPropertyA", "LeftBPropertyB", "RightAPropertyA", "RightBPropertyB" });
115+
.ShouldContain("LeftAPropertyA", "LeftBPropertyB", "RightAPropertyA", "RightBPropertyB");
117116

118117
static AutoPersistenceModel mapper;
119118
static ClassMapping mapping;

src/FluentNHibernate.Specs/Automapping/AutomappingSpecs.ElementCollections.cs

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using FluentNHibernate.MappingModel.Collections;
77
using FluentNHibernate.Specs.Automapping.Fixtures;
88
using Machine.Specifications;
9-
using FluentAssertions;
109

1110
namespace FluentNHibernate.Specs.Automapping;
1211

@@ -16,7 +15,7 @@ public class when_the_automapper_is_asked_if_it_can_map_a_list_of_strings : Auto
1615
maps_property = step.ShouldMap(FakeMembers.IListOfStrings);
1716

1817
It should_accept_the_property = () =>
19-
maps_property.Should().BeTrue();
18+
maps_property.ShouldBeTrue();
2019

2120
static bool maps_property;
2221
}
@@ -27,7 +26,7 @@ public class when_the_automapper_is_asked_if_it_can_map_a_list_of_ints : AutoMap
2726
maps_property = step.ShouldMap(FakeMembers.IListOfInts);
2827

2928
It should_accept_the_property = () =>
30-
maps_property.Should().BeTrue();
29+
maps_property.ShouldBeTrue();
3130

3231
static bool maps_property;
3332
}
@@ -38,7 +37,7 @@ public class when_the_automapper_is_asked_if_it_can_map_a_list_of_doubles : Auto
3837
maps_property = step.ShouldMap(FakeMembers.IListOfDoubles);
3938

4039
It should_accept_the_property = () =>
41-
maps_property.Should().BeTrue();
40+
maps_property.ShouldBeTrue();
4241

4342
static bool maps_property;
4443
}
@@ -49,7 +48,7 @@ public class when_the_automapper_is_asked_if_it_can_map_a_list_of_shorts : AutoM
4948
maps_property = step.ShouldMap(FakeMembers.IListOfShorts);
5049

5150
It should_accept_the_property = () =>
52-
maps_property.Should().BeTrue();
51+
maps_property.ShouldBeTrue();
5352

5453
static bool maps_property;
5554
}
@@ -60,7 +59,7 @@ public class when_the_automapper_is_asked_if_it_can_map_a_list_of_longs : AutoMa
6059
maps_property = step.ShouldMap(FakeMembers.IListOfLongs);
6160

6261
It should_accept_the_property = () =>
63-
maps_property.Should().BeTrue();
62+
maps_property.ShouldBeTrue();
6463

6564
static bool maps_property;
6665
}
@@ -71,7 +70,7 @@ public class when_the_automapper_is_asked_if_it_can_map_a_list_of_floats : AutoM
7170
maps_property = step.ShouldMap(FakeMembers.IListOfFloats);
7271

7372
It should_accept_the_property = () =>
74-
maps_property.Should().BeTrue();
73+
maps_property.ShouldBeTrue();
7574

7675
static bool maps_property;
7776
}
@@ -82,7 +81,7 @@ public class when_the_automapper_is_asked_if_it_can_map_a_list_of_bools : AutoMa
8281
maps_property = step.ShouldMap(FakeMembers.IListOfBools);
8382

8483
It should_accept_the_property = () =>
85-
maps_property.Should().BeTrue();
84+
maps_property.ShouldBeTrue();
8685

8786
static bool maps_property;
8887
}
@@ -93,7 +92,7 @@ public class when_the_automapper_is_asked_if_it_can_map_a_list_of_DateTimes : Au
9392
maps_property = step.ShouldMap(FakeMembers.IListOfDateTimes);
9493

9594
It should_accept_the_property = () =>
96-
maps_property.Should().BeTrue();
95+
maps_property.ShouldBeTrue();
9796

9897
static bool maps_property;
9998
}
@@ -107,7 +106,7 @@ public class when_the_automapper_is_told_to_map_a_list_of_simple_types_with_a_cu
107106
step.Map(container, FakeMembers.IListOfStrings);
108107

109108
It should_create_use_the_element_column_name_defined_in_the_expressions = () =>
110-
container.Collections.Single().Element.Columns.Single().Name.Should().Be("custom_column");
109+
container.Collections.Single().Element.Columns.Single().Name.ShouldEqual("custom_column");
111110
}
112111

113112
public class when_the_automapper_is_told_to_map_a_list_of_simple_types : AutoMapOneToManySpec
@@ -116,43 +115,43 @@ public class when_the_automapper_is_told_to_map_a_list_of_simple_types : AutoMap
116115
step.Map(container, FakeMembers.IListOfStrings);
117116

118117
It should_create_a_collection = () =>
119-
container.Collections.Count().Should().Be(1);
118+
container.Collections.Count().ShouldEqual(1);
120119

121120
It should_create_a_collection_that_s_a_bag = () =>
122-
container.Collections.Single().Collection.Should().Be(Collection.Bag);
121+
container.Collections.Single().Collection.ShouldEqual(Collection.Bag);
123122

124123
It should_create_an_element_for_the_collection = () =>
125-
container.Collections.Single().Element.Should().NotBeNull();
124+
container.Collections.Single().Element.ShouldNotBeNull();
126125

127126
It should_use_the_default_element_column = () =>
128-
container.Collections.Single().Element.Columns.Single().Name.Should().Be("Value");
127+
container.Collections.Single().Element.Columns.Single().Name.ShouldEqual("Value");
129128

130129
It should_set_the_element_type_to_the_first_generic_argument_of_the_collection_type = () =>
131-
container.Collections.Single().Element.Type.Should().Be(new TypeReference(typeof(string)));
130+
container.Collections.Single().Element.Type.ShouldEqual(new TypeReference(typeof(string)));
132131

133132
It should_create_a_key = () =>
134-
container.Collections.Single().Key.Should().NotBeNull();
133+
container.Collections.Single().Key.ShouldNotBeNull();
135134

136135
It should_set_the_key_s_containing_entity_to_the_type_owning_the_property = () =>
137-
container.Collections.Single().Key.ContainingEntityType.Should().Be(FakeMembers.Type);
136+
container.Collections.Single().Key.ContainingEntityType.ShouldEqual(FakeMembers.Type);
138137

139138
It should_create_a_column_for_the_key_with_the_default_id_naming = () =>
140-
container.Collections.Single().Key.Columns.Single().Name.Should().Be("Target_id");
139+
container.Collections.Single().Key.Columns.Single().Name.ShouldEqual("Target_id");
141140

142141
It should_set_the_collection_s_containing_entity_type_to_the_type_owning_the_property = () =>
143-
container.Collections.Single().ContainingEntityType.Should().Be(FakeMembers.Type);
142+
container.Collections.Single().ContainingEntityType.ShouldEqual(FakeMembers.Type);
144143

145144
It should_set_the_collection_s_member_to_the_property = () =>
146-
container.Collections.Single().Member.Should().Be(FakeMembers.IListOfStrings);
145+
container.Collections.Single().Member.ShouldEqual(FakeMembers.IListOfStrings);
147146

148147
It should_set_the_collection_s_name_to_the_property_name = () =>
149-
container.Collections.Single().Name.Should().Be(FakeMembers.IListOfStrings.Name);
148+
container.Collections.Single().Name.ShouldEqual(FakeMembers.IListOfStrings.Name);
150149

151150
It should_not_create_a_relationship_for_the_collection = () =>
152-
container.Collections.Single().Relationship.Should().BeNull();
151+
container.Collections.Single().Relationship.ShouldBeNull();
153152

154153
It should_not_create_a_component_for_the_collection = () =>
155-
container.Collections.Single().CompositeElement.Should().BeNull();
154+
container.Collections.Single().CompositeElement.ShouldBeNull();
156155
}
157156

158157
public abstract class AutoMapOneToManySpec

src/FluentNHibernate.Specs/Automapping/AutomappingSpecs.Properties.Enum.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using FluentNHibernate.MappingModel.ClassBased;
44
using FluentNHibernate.Specs.Automapping.Fixtures;
55
using Machine.Specifications;
6-
using FluentAssertions;
76
using NHibernate.Type;
87

98
namespace FluentNHibernate.Specs.Automapping;
@@ -17,7 +16,7 @@ public class when_the_automapper_is_told_to_map_an_entity_with_static_properties
1716
mapping = mapper.BuildMappings().SelectMany(x => x.Classes).First();
1817

1918
It should_not_create_property_mappings_for_the_static_properties = () =>
20-
mapping.Properties.Any(x => x.Name == "StaticProperty").Should().BeFalse();
19+
mapping.Properties.Any(x => x.Name == "StaticProperty").ShouldBeFalse();
2120

2221
static AutoPersistenceModel mapper;
2322
static ClassMapping mapping;
@@ -35,7 +34,7 @@ public class when_the_automapper_is_told_to_map_an_entity_with_a_enum_property :
3534
mapping.Properties.ShouldContain(x => x.Name == "EnumProperty");
3635

3736
It should_use_the_enum_string_type_for_the_property = () =>
38-
mapping.Properties.First().Type.GetUnderlyingSystemType().Should().Be(typeof(EnumStringType<Enum>));
37+
mapping.Properties.First().Type.GetUnderlyingSystemType().ShouldEqual(typeof(EnumStringType<Enum>));
3938

4039
It should_create_a_column_for_the_property_mapping_with_the_property_name = () =>
4140
mapping.Properties.First().Columns.ShouldContain(x => x.Name == "EnumProperty");
@@ -53,7 +52,7 @@ public class when_the_automapper_is_told_to_map_an_entity_with_a_nullable_enum_p
5352
mapping.Properties.ShouldContain(x => x.Name == "EnumProperty");
5453

5554
It should_use_the_enum_string_mapper_for_the_property = () =>
56-
mapping.Properties.First().Type.GetUnderlyingSystemType().Should().Be(typeof(EnumStringType<Enum>));
55+
mapping.Properties.First().Type.GetUnderlyingSystemType().ShouldEqual(typeof(EnumStringType<Enum>));
5756

5857
It should_create_a_column_for_the_property_mapping_with_the_property_name = () =>
5958
mapping.Properties.First().Columns.ShouldContain(x => x.Name == "EnumProperty");

0 commit comments

Comments
 (0)