Skip to content

Commit fa18cec

Browse files
ngbrownhazzik
authored andcommitted
NH-3900 - NUnit 3.x - Update all obsolete NUnit constraints.
1 parent 468188f commit fa18cec

File tree

83 files changed

+238
-238
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+238
-238
lines changed

src/NHibernate.Test/Ado/BatcherFixture.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,9 @@ public void SqlLog()
177177
sessions.Statistics.Clear();
178178
FillDb();
179179
string logs = sl.GetWholeLog();
180-
Assert.That(logs, Is.Not.StringContaining("Adding to batch").IgnoreCase);
181-
Assert.That(logs, Is.StringContaining("Batch command").IgnoreCase);
182-
Assert.That(logs, Is.StringContaining("INSERT").IgnoreCase);
180+
Assert.That(logs, Does.Not.Contain("Adding to batch").IgnoreCase);
181+
Assert.That(logs, Does.Contain("Batch command").IgnoreCase);
182+
Assert.That(logs, Does.Contain("INSERT").IgnoreCase);
183183
}
184184
}
185185

@@ -201,13 +201,13 @@ public void AbstractBatcherLog()
201201
sessions.Statistics.Clear();
202202
FillDb();
203203
string logs = sl.GetWholeLog();
204-
Assert.That(logs, Is.StringContaining("batch").IgnoreCase);
204+
Assert.That(logs, Does.Contain("batch").IgnoreCase);
205205
foreach (var loggingEvent in sl.Appender.GetEvents())
206206
{
207207
string message = loggingEvent.RenderedMessage;
208208
if(message.ToLowerInvariant().Contains("insert"))
209209
{
210-
Assert.That(message, Is.StringContaining("batch").IgnoreCase);
210+
Assert.That(message, Does.Contain("batch").IgnoreCase);
211211
}
212212
}
213213
}
@@ -227,7 +227,7 @@ public void SqlLogShouldGetBatchCommandNotification()
227227
sessions.Statistics.Clear();
228228
FillDb();
229229
string logs = sl.GetWholeLog();
230-
Assert.That(logs, Is.StringContaining("Batch commands:").IgnoreCase);
230+
Assert.That(logs, Does.Contain("Batch commands:").IgnoreCase);
231231
}
232232
}
233233

@@ -257,8 +257,8 @@ public void AbstractBatcherLogFormattedSql()
257257
{
258258
if(sqlLine.Contains("p0"))
259259
{
260-
Assert.That(sqlLine, Is.StringContaining("p1"));
261-
Assert.That(sqlLine, Is.StringContaining("p2"));
260+
Assert.That(sqlLine, Does.Contain("p1"));
261+
Assert.That(sqlLine, Does.Contain("p2"));
262262
}
263263
}
264264
}
@@ -270,4 +270,4 @@ public void AbstractBatcherLogFormattedSql()
270270
Cleanup();
271271
}
272272
}
273-
}
273+
}

src/NHibernate.Test/Bytecode/Lightweight/BytecodeProviderFixture.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ public void UnableToLoadProxyFactoryFactory()
2828
}
2929
catch (HibernateByteCodeException e)
3030
{
31-
Assert.That(e.Message, Is.StringStarting("Unable to load type"));
32-
Assert.That(e.Message, Is.StringContaining("Possible causes"));
33-
Assert.That(e.Message, Is.StringContaining("Confirm that your deployment folder contains"));
31+
Assert.That(e.Message, Does.StartWith("Unable to load type"));
32+
Assert.That(e.Message, Does.Contain("Possible causes"));
33+
Assert.That(e.Message, Does.Contain("Confirm that your deployment folder contains"));
3434
}
3535
}
3636

@@ -62,7 +62,7 @@ public void CantCreateProxyFactoryFactory()
6262
}
6363
catch (HibernateByteCodeException e)
6464
{
65-
Assert.That(e.Message,Is.StringStarting("Failed to create an instance of"));
65+
Assert.That(e.Message,Does.StartWith("Failed to create an instance of"));
6666
}
6767
}
6868

@@ -156,4 +156,4 @@ public void ShouldNotThrownAnExceptionWithTheSameTypeOfCollectionTypeFactory()
156156
Assert.DoesNotThrow(() => bcp.SetCollectionTypeFactoryClass(typeof (Type.DefaultCollectionTypeFactory)));
157157
}
158158
}
159-
}
159+
}

src/NHibernate.Test/CacheTest/QueryKeyFixture.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,15 @@ public void ToStringWithFilters()
114114
var fk = new FilterKey(filterName, f.Parameters, f.FilterDefinition.ParameterTypes, EntityMode.Poco);
115115
ISet<FilterKey> fks = new HashSet<FilterKey> { fk };
116116
var qk = new QueryKey(sessions, SqlAll, new QueryParameters(), fks, null);
117-
Assert.That(qk.ToString(), Is.StringContaining(string.Format("filters: ['{0}']",fk)));
117+
Assert.That(qk.ToString(), Does.Contain(string.Format("filters: ['{0}']",fk)));
118118

119119
filterName = "DescriptionEqualAndValueGT";
120120
f = new FilterImpl(sessions.GetFilterDefinition(filterName));
121121
f.SetParameter("pDesc", "something").SetParameter("pValue", 10);
122122
fk = new FilterKey(filterName, f.Parameters, f.FilterDefinition.ParameterTypes, EntityMode.Poco);
123123
fks = new HashSet<FilterKey> { fk };
124124
qk = new QueryKey(sessions, SqlAll, new QueryParameters(), fks, null);
125-
Assert.That(qk.ToString(), Is.StringContaining(string.Format("filters: ['{0}']", fk)));
125+
Assert.That(qk.ToString(), Does.Contain(string.Format("filters: ['{0}']", fk)));
126126
}
127127

128128
[Test]
@@ -140,7 +140,7 @@ public void ToStringWithMoreFilters()
140140

141141
ISet<FilterKey> fks = new HashSet<FilterKey> { fk, fvk };
142142
var qk = new QueryKey(sessions, SqlAll, new QueryParameters(), fks, null);
143-
Assert.That(qk.ToString(), Is.StringContaining(string.Format("filters: ['{0}', '{1}']", fk, fvk)));
143+
Assert.That(qk.ToString(), Does.Contain(string.Format("filters: ['{0}', '{1}']", fk, fvk)));
144144
}
145145
}
146-
}
146+
}

src/NHibernate.Test/CfgTest/CustomBytecodeProviderTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public void WhenNoDefaultCtorThenThrow()
5555
{
5656
var properties = new Dictionary<string, string> { { Environment.PropertyBytecodeProvider, typeof(InvalidNoCtorByteCodeProvider).AssemblyQualifiedName } };
5757
Assert.That(() => Environment.BuildBytecodeProvider(properties), Throws.TypeOf<HibernateByteCodeException>()
58-
.And.InnerException.Message.ContainsSubstring("constructor was not found"));
58+
.And.InnerException.Message.Contains("constructor was not found"));
5959
}
6060
}
61-
}
61+
}

src/NHibernate.Test/CfgTest/Loquacious/EntityCacheConfigurationFixture.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public void NotAllowRelatedCollections()
7777
var exception =
7878
Assert.Throws<ArgumentOutOfRangeException>(
7979
() => configure.EntityCache<EntityToCache>(ce => ce.Collection(e => e.Relation.Elements, cc => { })));
80-
Assert.That(exception.Message, Is.StringContaining("Collection not owned by"));
80+
Assert.That(exception.Message, Does.Contain("Collection not owned by"));
8181
}
8282
}
83-
}
83+
}

src/NHibernate.Test/Component/Basic/ComponentWithUniqueConstraintTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ public void CannotBePersistedWithNonUniqueValues()
8484
});
8585
Assert.That(exception.InnerException, Is.AssignableTo<DbException>());
8686
Assert.That(exception.InnerException.Message,
87-
Is.StringContaining("unique").IgnoreCase.And.StringContaining("constraint").IgnoreCase
88-
.Or.StringContaining("duplicate entry").IgnoreCase);
87+
Does.Contain("unique").IgnoreCase.And.Contains("constraint").IgnoreCase
88+
.Or.Contains("duplicate entry").IgnoreCase);
8989
}
9090
}
9191
}
92-
}
92+
}

src/NHibernate.Test/Events/PostEvents/PostUpdateFixture.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public void ImplicitFlush()
4040
tx.Commit();
4141
}
4242
}
43-
Assert.That(ls.GetWholeLog(), Is.StringContaining(AssertOldStatePostListener.LogMessage));
43+
Assert.That(ls.GetWholeLog(), Does.Contain(AssertOldStatePostListener.LogMessage));
4444
}
4545

4646
DbCleanup();
@@ -69,7 +69,7 @@ public void ExplicitUpdate()
6969
tx.Commit();
7070
}
7171
}
72-
Assert.That(ls.GetWholeLog(), Is.StringContaining(AssertOldStatePostListener.LogMessage));
72+
Assert.That(ls.GetWholeLog(), Does.Contain(AssertOldStatePostListener.LogMessage));
7373
}
7474

7575
DbCleanup();
@@ -107,7 +107,7 @@ public void WithDetachedObject()
107107
tx.Commit();
108108
}
109109
}
110-
Assert.That(ls.GetWholeLog(), Is.StringContaining(AssertOldStatePostListener.LogMessage));
110+
Assert.That(ls.GetWholeLog(), Does.Contain(AssertOldStatePostListener.LogMessage));
111111
}
112112

113113
DbCleanup();
@@ -147,7 +147,7 @@ public void UpdateDetachedObject()
147147
tx.Commit();
148148
}
149149
}
150-
Assert.That(ls.GetWholeLog(), Is.StringContaining(AssertOldStatePostListener.LogMessage));
150+
Assert.That(ls.GetWholeLog(), Does.Contain(AssertOldStatePostListener.LogMessage));
151151
}
152152

153153
DbCleanup();
@@ -186,7 +186,7 @@ public void UpdateDetachedObjectWithLock()
186186
tx.Commit();
187187
}
188188
}
189-
Assert.That(ls.GetWholeLog(), Is.StringContaining(AssertOldStatePostListener.LogMessage));
189+
Assert.That(ls.GetWholeLog(), Does.Contain(AssertOldStatePostListener.LogMessage));
190190
}
191191

192192
DbCleanup();
@@ -216,4 +216,4 @@ private void FillDb()
216216
}
217217
}
218218
}
219-
}
219+
}

src/NHibernate.Test/ExpressionTest/InExpressionFixture.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ public void InSqlFunctionTest()
6060

6161
// Allow some dialectal differences in function name and parameter style.
6262
Assert.That(sql.ToString(),
63-
Is.StringStarting("substring(sql_alias.Name").Or.StringStarting("substr(sql_alias.Name"));
64-
Assert.That(sql.ToString(), Is.StringEnding(") in (?, ?)"));
63+
Does.StartWith("substring(sql_alias.Name").Or.StartsWith("substr(sql_alias.Name"));
64+
Assert.That(sql.ToString(), Does.EndWith(") in (?, ?)"));
6565

6666
// Ensure no parameters are duplicated.
6767
var parameters = criteriaQuery.CollectedParameters.ToList();
@@ -73,4 +73,4 @@ public void InSqlFunctionTest()
7373
}
7474
}
7575
}
76-
}
76+
}

src/NHibernate.Test/FilterTest/ConfigFixture.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public void WrongFilterDefInClass()
5757
var cfg = GetConfiguration();
5858
var e = Assert.Throws<MappingException>(() => cfg.AddResource("NHibernate.Test.FilterTest.WrongFilterDefInClass.hbm.xml", GetType().Assembly));
5959
Assert.That(e.InnerException, Is.Not.Null);
60-
Assert.That(e.InnerException.Message, Is.StringStarting("no filter condition").IgnoreCase);
60+
Assert.That(e.InnerException.Message, Does.StartWith("no filter condition").IgnoreCase);
6161
}
6262

6363
[Test]
@@ -93,7 +93,7 @@ public void WrongFilterDefInClassSeconPass()
9393
cfg.AddXmlString(wrongClassMap);
9494
cfg.AddXmlString(wrongFilterDef);
9595
var e = Assert.Throws<MappingException>(cfg.BuildMappings);
96-
Assert.That(e.Message, Is.StringStarting("no filter condition").IgnoreCase);
96+
Assert.That(e.Message, Does.StartWith("no filter condition").IgnoreCase);
9797
}
9898

9999
[Test]
@@ -103,8 +103,8 @@ public void AddClassWithFiltersWithoutFilterDef()
103103
var cfg = GetConfiguration();
104104
cfg.AddResource("NHibernate.Test.FilterTest.SimpleFiltered.hbm.xml", GetType().Assembly);
105105
var e = Assert.Throws<MappingException>(cfg.BuildMappings);
106-
Assert.That(e.Message, Is.StringStarting("filter-def for filter named"));
107-
Assert.That(e.Message, Is.StringContaining("was not found"));
106+
Assert.That(e.Message, Does.StartWith("filter-def for filter named"));
107+
Assert.That(e.Message, Does.Contain("was not found"));
108108
}
109109

110110
[Test]
@@ -197,7 +197,7 @@ public void DuplicatedFilterDef()
197197
var cfg = GetConfiguration();
198198
var e = Assert.Throws<MappingException>(() => cfg.AddXmlString(filterDef));
199199
Assert.That(e.InnerException, Is.Not.Null);
200-
Assert.That(e.InnerException.Message, Is.StringContaining("Duplicated filter-def"));
200+
Assert.That(e.InnerException.Message, Does.Contain("Duplicated filter-def"));
201201
}
202202

203203
[Test]
@@ -223,8 +223,8 @@ public void MissedFilterDef()
223223
var cfg = GetConfiguration();
224224
cfg.AddXmlString(classMap);
225225
var e = Assert.Throws<MappingException>(()=>cfg.BuildSessionFactory());
226-
Assert.That(e.Message, Is.StringStarting("filter-def for filter named"));
227-
Assert.That(e.Message, Is.StringContaining("was not found"));
226+
Assert.That(e.Message, Does.StartWith("filter-def for filter named"));
227+
Assert.That(e.Message, Does.Contain("was not found"));
228228
}
229229

230230
[Test]
@@ -248,8 +248,8 @@ public void FilterDefWithoutReference()
248248
cfg.BuildSessionFactory();
249249

250250
var wholeLog = String.Join("\r\n", memoryAppender.GetEvents().Select(x => x.RenderedMessage).ToArray());
251-
Assert.That(wholeLog, Is.StringContaining("filter-def for filter named"));
252-
Assert.That(wholeLog, Is.StringContaining("was never used to filter classes nor collections."));
251+
Assert.That(wholeLog, Does.Contain("filter-def for filter named"));
252+
Assert.That(wholeLog, Does.Contain("was never used to filter classes nor collections."));
253253
}
254254
finally
255255
{

src/NHibernate.Test/GhostProperty/GhostPropertyFixture.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public void WillLoadGhostAssociationOnAccess()
127127
{
128128
order = s.Get<Order>(1);
129129
var logMessage = ls.GetWholeLog();
130-
Assert.That(logMessage, Is.Not.StringContaining("FROM Payment"));
130+
Assert.That(logMessage, Does.Not.Contain("FROM Payment"));
131131
}
132132
Assert.That(NHibernateUtil.IsPropertyInitialized(order, "Payment"), Is.False);
133133

@@ -147,8 +147,8 @@ public void WhenGetThenLoadOnlyNoLazyPlainProperties()
147147
{
148148
order = s.Get<Order>(1);
149149
var logMessage = ls.GetWholeLog();
150-
Assert.That(logMessage, Is.Not.StringContaining("ALazyProperty"));
151-
Assert.That(logMessage, Is.StringContaining("NoLazyProperty"));
150+
Assert.That(logMessage, Does.Not.Contain("ALazyProperty"));
151+
Assert.That(logMessage, Does.Contain("NoLazyProperty"));
152152
}
153153
Assert.That(NHibernateUtil.IsPropertyInitialized(order, "NoLazyProperty"), Is.True);
154154
Assert.That(NHibernateUtil.IsPropertyInitialized(order, "ALazyProperty"), Is.False);
@@ -157,10 +157,10 @@ public void WhenGetThenLoadOnlyNoLazyPlainProperties()
157157
{
158158
var x = order.ALazyProperty;
159159
var logMessage = ls.GetWholeLog();
160-
Assert.That(logMessage, Is.StringContaining("ALazyProperty"));
160+
Assert.That(logMessage, Does.Contain("ALazyProperty"));
161161
}
162162
Assert.That(NHibernateUtil.IsPropertyInitialized(order, "ALazyProperty"), Is.True);
163163
}
164164
}
165165
}
166-
}
166+
}

0 commit comments

Comments
 (0)