Skip to content

Commit

Permalink
NH-3900 - NUnit 3.x - Update all obsolete NUnit constraints.
Browse files Browse the repository at this point in the history
  • Loading branch information
ngbrown authored and hazzik committed Feb 11, 2017
1 parent 468188f commit fa18cec
Show file tree
Hide file tree
Showing 83 changed files with 238 additions and 238 deletions.
18 changes: 9 additions & 9 deletions src/NHibernate.Test/Ado/BatcherFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ public void SqlLog()
sessions.Statistics.Clear();
FillDb();
string logs = sl.GetWholeLog();
Assert.That(logs, Is.Not.StringContaining("Adding to batch").IgnoreCase);
Assert.That(logs, Is.StringContaining("Batch command").IgnoreCase);
Assert.That(logs, Is.StringContaining("INSERT").IgnoreCase);
Assert.That(logs, Does.Not.Contain("Adding to batch").IgnoreCase);
Assert.That(logs, Does.Contain("Batch command").IgnoreCase);
Assert.That(logs, Does.Contain("INSERT").IgnoreCase);
}
}

Expand All @@ -201,13 +201,13 @@ public void AbstractBatcherLog()
sessions.Statistics.Clear();
FillDb();
string logs = sl.GetWholeLog();
Assert.That(logs, Is.StringContaining("batch").IgnoreCase);
Assert.That(logs, Does.Contain("batch").IgnoreCase);
foreach (var loggingEvent in sl.Appender.GetEvents())
{
string message = loggingEvent.RenderedMessage;
if(message.ToLowerInvariant().Contains("insert"))
{
Assert.That(message, Is.StringContaining("batch").IgnoreCase);
Assert.That(message, Does.Contain("batch").IgnoreCase);
}
}
}
Expand All @@ -227,7 +227,7 @@ public void SqlLogShouldGetBatchCommandNotification()
sessions.Statistics.Clear();
FillDb();
string logs = sl.GetWholeLog();
Assert.That(logs, Is.StringContaining("Batch commands:").IgnoreCase);
Assert.That(logs, Does.Contain("Batch commands:").IgnoreCase);
}
}

Expand Down Expand Up @@ -257,8 +257,8 @@ public void AbstractBatcherLogFormattedSql()
{
if(sqlLine.Contains("p0"))
{
Assert.That(sqlLine, Is.StringContaining("p1"));
Assert.That(sqlLine, Is.StringContaining("p2"));
Assert.That(sqlLine, Does.Contain("p1"));
Assert.That(sqlLine, Does.Contain("p2"));
}
}
}
Expand All @@ -270,4 +270,4 @@ public void AbstractBatcherLogFormattedSql()
Cleanup();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ public void UnableToLoadProxyFactoryFactory()
}
catch (HibernateByteCodeException e)
{
Assert.That(e.Message, Is.StringStarting("Unable to load type"));
Assert.That(e.Message, Is.StringContaining("Possible causes"));
Assert.That(e.Message, Is.StringContaining("Confirm that your deployment folder contains"));
Assert.That(e.Message, Does.StartWith("Unable to load type"));
Assert.That(e.Message, Does.Contain("Possible causes"));
Assert.That(e.Message, Does.Contain("Confirm that your deployment folder contains"));
}
}

Expand Down Expand Up @@ -62,7 +62,7 @@ public void CantCreateProxyFactoryFactory()
}
catch (HibernateByteCodeException e)
{
Assert.That(e.Message,Is.StringStarting("Failed to create an instance of"));
Assert.That(e.Message,Does.StartWith("Failed to create an instance of"));
}
}

Expand Down Expand Up @@ -156,4 +156,4 @@ public void ShouldNotThrownAnExceptionWithTheSameTypeOfCollectionTypeFactory()
Assert.DoesNotThrow(() => bcp.SetCollectionTypeFactoryClass(typeof (Type.DefaultCollectionTypeFactory)));
}
}
}
}
8 changes: 4 additions & 4 deletions src/NHibernate.Test/CacheTest/QueryKeyFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,15 @@ public void ToStringWithFilters()
var fk = new FilterKey(filterName, f.Parameters, f.FilterDefinition.ParameterTypes, EntityMode.Poco);
ISet<FilterKey> fks = new HashSet<FilterKey> { fk };
var qk = new QueryKey(sessions, SqlAll, new QueryParameters(), fks, null);
Assert.That(qk.ToString(), Is.StringContaining(string.Format("filters: ['{0}']",fk)));
Assert.That(qk.ToString(), Does.Contain(string.Format("filters: ['{0}']",fk)));

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

[Test]
Expand All @@ -140,7 +140,7 @@ public void ToStringWithMoreFilters()

ISet<FilterKey> fks = new HashSet<FilterKey> { fk, fvk };
var qk = new QueryKey(sessions, SqlAll, new QueryParameters(), fks, null);
Assert.That(qk.ToString(), Is.StringContaining(string.Format("filters: ['{0}', '{1}']", fk, fvk)));
Assert.That(qk.ToString(), Does.Contain(string.Format("filters: ['{0}', '{1}']", fk, fvk)));
}
}
}
}
4 changes: 2 additions & 2 deletions src/NHibernate.Test/CfgTest/CustomBytecodeProviderTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void WhenNoDefaultCtorThenThrow()
{
var properties = new Dictionary<string, string> { { Environment.PropertyBytecodeProvider, typeof(InvalidNoCtorByteCodeProvider).AssemblyQualifiedName } };
Assert.That(() => Environment.BuildBytecodeProvider(properties), Throws.TypeOf<HibernateByteCodeException>()
.And.InnerException.Message.ContainsSubstring("constructor was not found"));
.And.InnerException.Message.Contains("constructor was not found"));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void NotAllowRelatedCollections()
var exception =
Assert.Throws<ArgumentOutOfRangeException>(
() => configure.EntityCache<EntityToCache>(ce => ce.Collection(e => e.Relation.Elements, cc => { })));
Assert.That(exception.Message, Is.StringContaining("Collection not owned by"));
Assert.That(exception.Message, Does.Contain("Collection not owned by"));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ public void CannotBePersistedWithNonUniqueValues()
});
Assert.That(exception.InnerException, Is.AssignableTo<DbException>());
Assert.That(exception.InnerException.Message,
Is.StringContaining("unique").IgnoreCase.And.StringContaining("constraint").IgnoreCase
.Or.StringContaining("duplicate entry").IgnoreCase);
Does.Contain("unique").IgnoreCase.And.Contains("constraint").IgnoreCase
.Or.Contains("duplicate entry").IgnoreCase);
}
}
}
}
}
12 changes: 6 additions & 6 deletions src/NHibernate.Test/Events/PostEvents/PostUpdateFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void ImplicitFlush()
tx.Commit();
}
}
Assert.That(ls.GetWholeLog(), Is.StringContaining(AssertOldStatePostListener.LogMessage));
Assert.That(ls.GetWholeLog(), Does.Contain(AssertOldStatePostListener.LogMessage));
}

DbCleanup();
Expand Down Expand Up @@ -69,7 +69,7 @@ public void ExplicitUpdate()
tx.Commit();
}
}
Assert.That(ls.GetWholeLog(), Is.StringContaining(AssertOldStatePostListener.LogMessage));
Assert.That(ls.GetWholeLog(), Does.Contain(AssertOldStatePostListener.LogMessage));
}

DbCleanup();
Expand Down Expand Up @@ -107,7 +107,7 @@ public void WithDetachedObject()
tx.Commit();
}
}
Assert.That(ls.GetWholeLog(), Is.StringContaining(AssertOldStatePostListener.LogMessage));
Assert.That(ls.GetWholeLog(), Does.Contain(AssertOldStatePostListener.LogMessage));
}

DbCleanup();
Expand Down Expand Up @@ -147,7 +147,7 @@ public void UpdateDetachedObject()
tx.Commit();
}
}
Assert.That(ls.GetWholeLog(), Is.StringContaining(AssertOldStatePostListener.LogMessage));
Assert.That(ls.GetWholeLog(), Does.Contain(AssertOldStatePostListener.LogMessage));
}

DbCleanup();
Expand Down Expand Up @@ -186,7 +186,7 @@ public void UpdateDetachedObjectWithLock()
tx.Commit();
}
}
Assert.That(ls.GetWholeLog(), Is.StringContaining(AssertOldStatePostListener.LogMessage));
Assert.That(ls.GetWholeLog(), Does.Contain(AssertOldStatePostListener.LogMessage));
}

DbCleanup();
Expand Down Expand Up @@ -216,4 +216,4 @@ private void FillDb()
}
}
}
}
}
6 changes: 3 additions & 3 deletions src/NHibernate.Test/ExpressionTest/InExpressionFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ public void InSqlFunctionTest()

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

// Ensure no parameters are duplicated.
var parameters = criteriaQuery.CollectedParameters.ToList();
Expand All @@ -73,4 +73,4 @@ public void InSqlFunctionTest()
}
}
}
}
}
18 changes: 9 additions & 9 deletions src/NHibernate.Test/FilterTest/ConfigFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void WrongFilterDefInClass()
var cfg = GetConfiguration();
var e = Assert.Throws<MappingException>(() => cfg.AddResource("NHibernate.Test.FilterTest.WrongFilterDefInClass.hbm.xml", GetType().Assembly));
Assert.That(e.InnerException, Is.Not.Null);
Assert.That(e.InnerException.Message, Is.StringStarting("no filter condition").IgnoreCase);
Assert.That(e.InnerException.Message, Does.StartWith("no filter condition").IgnoreCase);
}

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

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

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

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

[Test]
Expand All @@ -248,8 +248,8 @@ public void FilterDefWithoutReference()
cfg.BuildSessionFactory();

var wholeLog = String.Join("\r\n", memoryAppender.GetEvents().Select(x => x.RenderedMessage).ToArray());
Assert.That(wholeLog, Is.StringContaining("filter-def for filter named"));
Assert.That(wholeLog, Is.StringContaining("was never used to filter classes nor collections."));
Assert.That(wholeLog, Does.Contain("filter-def for filter named"));
Assert.That(wholeLog, Does.Contain("was never used to filter classes nor collections."));
}
finally
{
Expand Down
10 changes: 5 additions & 5 deletions src/NHibernate.Test/GhostProperty/GhostPropertyFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public void WillLoadGhostAssociationOnAccess()
{
order = s.Get<Order>(1);
var logMessage = ls.GetWholeLog();
Assert.That(logMessage, Is.Not.StringContaining("FROM Payment"));
Assert.That(logMessage, Does.Not.Contain("FROM Payment"));
}
Assert.That(NHibernateUtil.IsPropertyInitialized(order, "Payment"), Is.False);

Expand All @@ -147,8 +147,8 @@ public void WhenGetThenLoadOnlyNoLazyPlainProperties()
{
order = s.Get<Order>(1);
var logMessage = ls.GetWholeLog();
Assert.That(logMessage, Is.Not.StringContaining("ALazyProperty"));
Assert.That(logMessage, Is.StringContaining("NoLazyProperty"));
Assert.That(logMessage, Does.Not.Contain("ALazyProperty"));
Assert.That(logMessage, Does.Contain("NoLazyProperty"));
}
Assert.That(NHibernateUtil.IsPropertyInitialized(order, "NoLazyProperty"), Is.True);
Assert.That(NHibernateUtil.IsPropertyInitialized(order, "ALazyProperty"), Is.False);
Expand All @@ -157,10 +157,10 @@ public void WhenGetThenLoadOnlyNoLazyPlainProperties()
{
var x = order.ALazyProperty;
var logMessage = ls.GetWholeLog();
Assert.That(logMessage, Is.StringContaining("ALazyProperty"));
Assert.That(logMessage, Does.Contain("ALazyProperty"));
}
Assert.That(NHibernateUtil.IsPropertyInitialized(order, "ALazyProperty"), Is.True);
}
}
}
}
}
6 changes: 3 additions & 3 deletions src/NHibernate.Test/Hql/Ast/BulkManipulation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ public void UpdateOnImplicitJoinFails()
var e =
Assert.Throws<QueryException>(
() => s.CreateQuery("update Human set mother.name.initial = :initial").SetString("initial", "F").ExecuteUpdate());
Assert.That(e.Message, Is.StringStarting("Implied join paths are not assignable in update"));
Assert.That(e.Message, Does.StartWith("Implied join paths are not assignable in update"));

s.CreateQuery("delete Human where mother is not null").ExecuteUpdate();
s.CreateQuery("delete Human").ExecuteUpdate();
Expand Down Expand Up @@ -725,7 +725,7 @@ public void WrongPropertyNameThrowQueryException()
using (ISession s = OpenSession())
{
var e = Assert.Throws<QueryException>(() => s.CreateQuery("update Vehicle set owner = null where owner = 'Steve'").ExecuteUpdate());
Assert.That(e.Message, Is.StringStarting("Left side of assigment should be a case sensitive property or a field"));
Assert.That(e.Message, Does.StartWith("Left side of assigment should be a case sensitive property or a field"));
}
}

Expand Down Expand Up @@ -1120,4 +1120,4 @@ public void Cleanup()
}
}
}
}
}
10 changes: 5 additions & 5 deletions src/NHibernate.Test/Hql/Ast/QuerySubstitutionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public void WhenSubstitutionsConfiguredThenUseItInTranslation()
{
const string query = "from SimpleClass s where s.IntValue > pizza";
var sql = GetSql(query, new Dictionary<string, string>{{"pizza","1"}});
Assert.That(sql, Is.Not.StringContaining("pizza"));
Assert.That(sql, Does.Not.Contain("pizza"));
}

[Test]
Expand All @@ -31,7 +31,7 @@ public void WhenExecutedThroughSessionThenUseSubstitutions()
{
s.CreateQuery(query).List();
string sql = sqlLogSpy.Appender.GetEvents()[0].RenderedMessage;
Assert.That(sql, Is.Not.StringContaining("pizza"));
Assert.That(sql, Does.Not.Contain("pizza"));
}
}
}
Expand All @@ -41,7 +41,7 @@ public void WhenSubstitutionsWithStringConfiguredThenUseItInTranslation()
{
const string query = "from SimpleClass s where s.Description > calda";
var sql = GetSql(query, new Dictionary<string, string> { { "calda", "'bobrock'" } });
Assert.That(sql, Is.Not.StringContaining("pizza").And.Contains("'bobrock'"));
Assert.That(sql, Does.Not.Contain("pizza").And.Contains("'bobrock'"));
}

[Test]
Expand All @@ -54,9 +54,9 @@ public void WhenExecutedThroughSessionThenUseSubstitutionsWithString()
{
s.CreateQuery(query).List();
string sql = sqlLogSpy.Appender.GetEvents()[0].RenderedMessage;
Assert.That(sql, Is.Not.StringContaining("pizza").And.Contains("'bobrock'"));
Assert.That(sql, Does.Not.Contain("pizza").And.Contains("'bobrock'"));
}
}
}
}
}
}
4 changes: 2 additions & 2 deletions src/NHibernate.Test/Hql/Ast/SqlTranslationFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public void ParseFloatConstant()
{
const string query = "select 123.5, s from SimpleClass s";

Assert.That(GetSql(query), Is.StringStarting("select 123.5"));
Assert.That(GetSql(query), Does.StartWith("select 123.5"));
}

[Test]
Expand All @@ -30,4 +30,4 @@ public void Union()
Assert.DoesNotThrow(() => GetSql(queryForAntlr));
}
}
}
}
Loading

0 comments on commit fa18cec

Please sign in to comment.