protected NBiConstraint InstantiateConstraint(FasterThanXml fasterThanXml) { var ctr = new FasterThanConstraint(); ctr = ctr.MaxTimeMilliSeconds(fasterThanXml.MaxTimeMilliSeconds); if (fasterThanXml.CleanCache) ctr = ctr.CleanCache(); if (fasterThanXml.TimeOutMilliSeconds > 0) ctr = ctr.TimeOutMilliSeconds(fasterThanXml.TimeOutMilliSeconds); return ctr; }
protected global::NUnit.Framework.Constraints.Constraint InstantiateConstraint(FasterThanXml fasterThanXml) { var ctr = new FasterThanConstraint(); ctr = ctr.MaxTimeMilliSeconds(fasterThanXml.MaxTimeMilliSeconds); if (fasterThanXml.CleanCache) ctr = ctr.CleanCache(); if (fasterThanXml.TimeOutMilliSeconds > 0) ctr = ctr.TimeOutMilliSeconds(fasterThanXml.TimeOutMilliSeconds); return ctr; }
public void Matches_SlowerThanMaxTimeAndTimeOut_Failure() { var command = new SqlCommand(); command.Connection = new SqlConnection(ConnectionStringReader.GetSqlClient()); command.CommandText = "WAITFOR DELAY '00:00:10';"; var ctr = new FasterThanConstraint(); ctr = ctr.MaxTimeMilliSeconds(100); ctr = ctr.TimeOutMilliSeconds(1000); //Method under test Assert.That(ctr.Matches(command), Is.False); }
public void Matches_FasterThanMaxTime_Success() { var command = new SqlCommand(); command.Connection=new SqlConnection(ConnectionStringReader.GetSqlClient()); command.CommandText = "WAITFOR DELAY '00:00:00';"; var ctr = new FasterThanConstraint(); ctr = ctr.MaxTimeMilliSeconds(1000); ctr = ctr.TimeOutMilliSeconds(2000); //Method under test Assert.That(command, ctr); }