Skip to content

Commit ccd288c

Browse files
committed
NH-3900 - Update all obsolete NUnit constraints.
1 parent 1eaa462 commit ccd288c

File tree

80 files changed

+235
-235
lines changed

Some content is hidden

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

80 files changed

+235
-235
lines changed

src/NHibernate.Test.Linq/Linq/ByMethod/GroupByTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ into g
6363
select g.Key).ToList();
6464

6565
Assert.That(orders.Count, Is.EqualTo(481));
66-
Assert.That(Regex.Replace(spy.GetWholeLog(), @"\s+", " "), Is.StringContaining("group by order0_.OrderDate"));
66+
Assert.That(Regex.Replace(spy.GetWholeLog(), @"\s+", " "), Does.Contain("group by order0_.OrderDate"));
6767
}
6868
}
6969

src/NHibernate.Test.Linq/Linq/LoggingTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public void PageBetweenProjections()
2323

2424
const string expected =
2525
"Expression (partially evaluated): value(NHibernate.Linq.NhQueryable`1[NHibernate.DomainModel.Northwind.Entities.Product]).Where(p => value(NHibernate.Linq.NhQueryable`1[NHibernate.DomainModel.Northwind.Entities.Product]).Where(p => (p.ProductId > 5)).Contains(p)).Skip(5).Take(10)";
26-
Assert.That(logtext, Is.StringContaining(expected));
26+
Assert.That(logtext, Does.Contain(expected));
2727
}
2828
}
2929

@@ -50,7 +50,7 @@ public void CanLogLinqExpressionWithoutInitializingContainedProxy()
5050
const string expectedLog =
5151
"Expression (partially evaluated): value(NHibernate.Linq.NhQueryable`1[NHibernate.DomainModel.Northwind.Entities.Product])" +
5252
".Where(product => (product == Product#1)).Count()";
53-
Assert.That(actualLog, Is.StringContaining(expectedLog));
53+
Assert.That(actualLog, Does.Contain(expectedLog));
5454

5555
// And verify that the proxy in the expression wasn't initialized.
5656
Assert.That(NHibernateUtil.IsInitialized(productProxy), Is.False,

src/NHibernate.Test.Linq/Linq/WhereTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ public void CanUseCompareInQueryWithNonConstantZero()
753753
// This should generate SQL with some nested case expressions - it should not be
754754
// simplified.
755755
string wholeLog = ls.GetWholeLog();
756-
Assert.That(wholeLog, Is.StringContaining("when lower(product0_.ProductName)="));
756+
Assert.That(wholeLog, Does.Contain("when lower(product0_.ProductName)="));
757757
}
758758
}
759759

@@ -769,7 +769,7 @@ public void CanUseCompareInQuery(Expression<Func<Product, bool>> expression, int
769769
Assert.That(result, Has.Count.EqualTo(expectedCount));
770770

771771
string wholeLog = ls.GetWholeLog();
772-
Assert.That(wholeLog, expectCase ? Is.StringContaining("case") : Is.Not.StringContaining("case"));
772+
Assert.That(wholeLog, expectCase ? Does.Contain("case") : Does.Not.Contain("case"));
773773
}
774774
}
775775

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+
}

0 commit comments

Comments
 (0)