TestBase 3.0.8

*TestBase* gets you off to a flying start when unit testing projects with dependencies.
It offers a rich extensible set of fluent assertions and a set of verifiable Fake Ado.Net components, with easy setup and verification.

TestBase.Shoulds
------------------
Chainable fluent assertions get you to the point concisely
UnitUnderTest.Action()
 .ShouldNotBeNull()
 .ShouldContain(expected);
UnitUnderTest.OtherAction()
 .ShouldEqualByValue(
   new {Id=1, Payload=expectedPayload, Additional=new[]{ expected1, expected2 }}
);
* ShouldBe(), ShouldMatch(), ShouldNotBe(), ShouldContain(), ShouldNotContain(), ShouldBeEmpty(), ShouldNotBeEmpty(), ShouldAll() and many more
* ShouldEqualByValue() works with all kinds of object and collections
* Stream assertions include ShouldContain() and ShouldEqualByValue()

TestBase.FakeDb
------------------
Works with Ado.Net and technologies on top of it, including Dapper.
* fakeDbConnection.SetupForQuery(IEnumerable<TFakeData> )
* fakeDbConnection.SetupForQuery(IEnumerable<Tuple<TFakeDataForTable1,TFakeDataForTable2>> )
* fakeDbConnection.SetupForQuery(fakeData, new[] {"FieldName1", FieldName2"})
* fakeDbConnection.SetupForExecuteNonQuery(rowsAffected)
* fakeDbConnection.ShouldHaveUpdated("tableName", [Optional] fieldList, whereClauseField)
* fakeDbConnection.ShouldHaveSelected("tableName", [Optional] fieldList, whereClauseField)
* fakeDbConnection.ShouldHaveUpdated("tableName", [Optional] fieldList, whereClauseField)
* fakeDbConnection.ShouldHaveDeleted("tableName", whereClauseField)
* fakeDbConnection.ShouldHaveInvoked(cmd => predicate(cmd))
* fakeDbConnection.ShouldHaveXXX().ShouldHaveParameter("name", value)
* fakeDbConnection.Verify(x=>x.CommandText.Matches("Insert [case] .*") && x.Parameters["id"].Value==1)

TestBase.TestBase<T> AutoMocksAndFakes
--------------------------------
is in development and currently works non-recursively. It auto-constructs the UnitUnderTest.
It identifies constructor dependencies by name and type, looking in the following places:
1) Fields in the TestFixture class
2) Entries in the Mocks[] or Fake[] dictionaries
3) Finally it creates a Mock (if it's a mockable type) or a default instance (if its sealed, or value type) for anything that's missing

ChangeLog
---------
3.0.3.0 Improves FakeDb setup
3.0.x.0 adds and/or corrects missing Shoulds()
2.0.5.0 adds some intellisense and FakeDbConnection.Verify(..., message,args) overload

There is a newer version of this package available.
See the version list below for details.
Install-Package TestBase -Version 3.0.8
dotnet add package TestBase --version 3.0.8
<PackageReference Include="TestBase" Version="3.0.8" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TestBase --version 3.0.8
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Release Notes

3.0.2:
   Added
   * FakeDbConnection.SetUpForQuery<T1,T2>() overload which allows you to provide dummy data as Tuples. Which is sometimes easier way to setup fake data for Select joins.
   * FakeDbConnection.ShouldHaveUpdated() which verifies an "update <tablename> set .... where .... " command.
   * String.ShouldMatch(regex, RegexOptions) overload
   * String.ShouldMatchIgnoringCase(regex) overload
   * IEnumerable.SingeOrAssertFail() which you can give a better error message than just the Exception thrown by .Single()
   
   Still unpolished, but in use for over four years.

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
4.1.4.3 1,691 11/20/2018
4.1.4.1 872 11/16/2018
4.1.3.2 867 10/28/2018
4.1.3.1 839 10/26/2018
4.1.2.7 876 10/24/2018
4.1.2.4 851 10/16/2018
4.1.2.3 1,303 5/22/2018
4.1.2.2 919 5/22/2018
4.1.2.1 933 5/22/2018
4.1.2 956 5/19/2018
4.1.1 976 4/8/2018
4.1.0 930 4/3/2018
4.0.9.2 1,103 3/31/2018
4.0.9.1 987 3/28/2018
4.0.9 1,100 3/23/2018
4.0.8 1,069 3/23/2018
4.0.7 918 3/22/2018
4.0.6.2 946 3/9/2018
4.0.6.1 922 3/7/2018
4.0.5.2 957 3/2/2018
4.0.5 933 3/1/2018
4.0.4.2 967 3/1/2018
4.0.4 935 2/25/2018
4.0.3 957 2/25/2018
4.0.2 909 2/24/2018
4.0.1 976 2/24/2018
3.1.0 1,278 7/24/2016
3.0.8.5 1,021 7/23/2016
3.0.8.3 1,059 4/14/2016
3.0.8.2 1,003 3/31/2016
3.0.8.1 995 3/30/2016
3.0.8 1,039 3/29/2016
3.0.7.6 1,033 3/14/2016
3.0.7.5 1,007 3/10/2016
3.0.7.4 1,041 2/11/2016
3.0.7.3 1,030 1/29/2016
3.0.6.2 1,054 1/27/2016
3.0.6.1 1,034 1/26/2016
3.0.5 1,056 1/15/2016
3.0.4 1,039 1/13/2016
3.0.3 1,028 12/28/2015
3.0.2 2,760 12/27/2013
3.0.1.1 1,068 12/23/2013
3.0.1 1,136 11/28/2013
2.0.5 1,101 11/28/2013
2.0.4.1 1,091 11/12/2013
2.0.4 1,110 11/12/2013
2.0.3.1 1,071 11/8/2013
2.0.3 1,124 11/7/2013
2.0.2 1,103 11/7/2013
2.0.1 1,111 11/1/2013
1.0.4 1,102 10/31/2013
1.0.3 1,126 10/23/2013
Show less