Example #1
0
 /// <summary>
 /// Combines the template and additionalMessage with information contained in the
 /// assertion in order to produce and return a comprehensive message to be displayed 
 /// </summary>
 /// <param name="template">The template.</param>
 /// <param name="assertion">The assertion.</param>
 /// <param name="additionalMessage">The additional message.</param>
 /// <returns></returns>
 public static string ToFailedAssertionMessage(this string template, AccumulativeAssertion assertion, string additionalMessage)
 {
     string res = String.Format(template, assertion.WhereColumnDisplayString, assertion.TableName);
     if (additionalMessage == null)
         return res;
     return res + " " + additionalMessage;
 }
        public void AreEqual_HappyDays_WorksAsExpected()
        {
            var valueMap = new Dictionary<string, object> { { "LastName", "Hansen" } };
            StubSqlProvider.Current.SetValueMap(valueMap);

            var assertion = new AccumulativeAssertion(StubSqlProvider.Current);
            assertion.AddWhereColumn("Id", 1111);

            assertion.AreEqual("LastName", "Hansen");
        }
        public void Exists_HappyDays_SendsExpectedSqlToSqlExecutor()
        {
            decimal returnObject = 1;

            StubSqlProvider.Current.SetObjectToReturn(returnObject);

            var assertion = new AccumulativeAssertion(StubSqlProvider.Current);
            assertion.AddWhereColumn("FirstName", "Petter");

            assertion.Exists();

            string expectedSql = "SELECT count(*) FROM  WHERE FirstName = 'Petter'";
            Assert.AreEqual(expectedSql, StubSqlProvider.Current.Sql);
        }