ExpressionToCodeLib 3.3.0

Generates valid, readable C# from an expression tree, and can annotate that code with runtime values. Useful for e.g. code generation and unit testing assertions.

Install-Package ExpressionToCodeLib -Version 3.3.0
dotnet add package ExpressionToCodeLib --version 3.3.0
<PackageReference Include="ExpressionToCodeLib" Version="3.3.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ExpressionToCodeLib --version 3.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Release Notes

Annotate nullability for C# 8.0

NuGet packages (6)

Showing the top 5 NuGet packages that depend on ExpressionToCodeLib:

Package Downloads
TestBase
*TestBase* gives you a flying start with - fluent assertions that are easy to extend - sharp error messages - tools to help you test with “heavyweight” dependencies on - AspNetCore.Mvc, AspNet.Mvc or WebApi Contexts - HttpClient - Ado.Net - Streams & Logging - Mix & match with your favourite test runners & assertions. ``` UnitUnderTest.Action() .ShouldNotBeNull() .ShouldEqualByValueExceptFor(new {Id=1, Descr=expected}, ignoreList ) .Payload .ShouldMatchIgnoringCase("I expected this") .Should(someOtherPredicate); .Items .ShouldAll(predicate) .ShouldContain(item) .ShouldNotContain(predicate) .Where(predicate) .SingleOrAssertFail() .ShouldEqualByValue().ShouldEqualByValueExceptFor(...).ShouldEqualByValueOnMembers() work with all kinds of object and collections, and report what differed. string.ShouldMatch(pattern).ShouldNotMatch().ShouldBeEmpty().ShouldNotBeEmpty() .ShouldNotBeNullOrEmptyOrWhiteSpace().ShouldEqualIgnoringCase() .ShouldContain().ShouldStartWith().ShouldEndWith().ShouldBeContainedIn(), ... numeric.ShouldBeBetween().ShouldEqualWithTolerance()....GreaterThan....LessThan...GreaterOrEqualTo ... ienumerable.ShouldAll().ShouldContain().ShouldNotContain().ShouldBeEmpty().ShouldNotBeEmpty() ... stream.ShouldHaveSameStreamContentAs().ShouldContain() value.ShouldBe().ShouldNotBe().ShouldBeOfType().ShouldBeAssignableTo()... ``` TestBase.HttpClient.Fake ``` new FakeHttpClient() .Setup(x=>x.RequestUri.PathAndQuery.StartsWith("/this")) .Returns(response) .Setup(x=>x.Method==HttpMethod.Put) .Returns(new HttpResponseMessage(HttpStatusCode.Accepted)); ``` TestBase.AdoNet ------------------ `FakeDbConnection` ``` - db.SetupForQuery(…) - db.SetupForExecuteNonQuery(…) - db.ShouldHaveUpdated("tableName", …) - db.ShouldHaveSelected("tableName", …) - db.ShouldHaveDeleted("tableName", …) - db.Verify( x=>x.CommandText.Matches("Insert [case] .*") && x.Parameters["id"].Value==1 ) - db .ShouldHaveInvoked(cmd => predicate(cmd)) .ShouldHaveParameter("name", value) ``` `RecordingDbConnection` TestBase.Mvc.AspNetCore & TestBase.Mvc for Mvc 4 & Mvc 5 -------------------------------------------------------- ``` ControllerUnderTest.WithControllerContext() .Action() .ShouldbeViewResult() .ShouldHaveModel<TModel>() .ShouldEqualByValue(expected) ControllerUnderTest.Action() .ShouldBeRedirectToRouteResult() .ShouldHaveRouteValue("expectedKey", [Optional] "expectedValue"); ShouldHaveViewDataContaining(), ShouldBeJsonResult() etc. ``` - Test AspNetCore controllers with zero setup using `controllerUnderTest.WithControllerContext(actionUnderTest)` - Test more complex AspNetCore controller/application dependencies using `HostedMvcTestFixtureBase` and specify your MVCApplications `Startup` class. ``` [TestCase("/dummy")] public async Task Put_Should_ReturnA(string url) { var httpClient=GivenClientForRunningServer<Startup>(); GivenRequestHeaders(httpClient, "CustomHeader", "HeaderValue1"); var result = await httpClient.PutAsync(url, json); result.ShouldBe_202Accepted(); } ``` For Mvc4 and Mvc 5, fake your http request &amp; context, and use the `RegisterRoutes` method of your actual application to set up `Controller.Url` ``` ControllerUnderTest .WithHttpContextAndRoutes( RouteConfig.RegisterRoutes, "/incomingurl" ); ApiControllerUnderTest.WithWebApiHttpContext<T>( httpMethod, requestUri, routeTemplate) ``` Testable Logging ``` // Extensions.Logging.ListOfString var log = new List<String>(); ILogger mslogger= new LoggerFactory().AddStringListLogger(log).CreateLogger("Test2"); // Serilog.Sinks.ListOfString Serilog.Logger slogger= new LoggerConfiguration().WriteTo.StringList(log).CreateLogger(); ```
ProgressOnderwijsUtils
Collection of utilities developed by ProgressOnderwijs
TestBase.AdoNet
TestBase.AdoNet TestBase.FakeDb ------------------ Fake and verify AdoNet queries and commands ``` - 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.ShouldHaveExecutedStoredProcedure("name") - fakeDbConnection.ShouldHaveXXX().ShouldHaveParameter("name", value) - fakeDbConnection.Verify(x=>x.CommandText.Matches("Insert [case] .*") && x.Parameters["id"].Value==1) ``` TestBase.RecordingDb -------------------- * `new RecordingDbConnection(IDbConnection)` helps you profile Ado.Net Db calls See also - TestBase - TestBase.Mvc - TestBase.AdoNet - Serilog.Sinks.ListOfString - Extensions.Logging.ListOfString
ExpressiveAssertions
Flexible assertion library leveraging the .NET expression tree syntax
FranSync.DependencyInjection.WindsorCastle
FranSync.Configuration

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
3.3.0 5,238 9/12/2019
3.2.0 3,092 2/10/2019
3.1.0 7,055 7/10/2018
3.1.0-alpha 593 7/10/2018
3.0.0 10,796 6/27/2018
3.0.0-beta1 593 6/26/2018
3.0.0-alpha4 594 6/15/2018
3.0.0-alpha3 606 6/15/2018
3.0.0-alpha2 621 6/12/2018
3.0.0-alpha1 618 6/3/2018
2.7.0 13,280 2/19/2018
2.6.0 723 2/16/2018
2.6.0-signed 704 2/16/2018
2.5.1 5,833 10/30/2017
2.5.0 976 9/20/2017
2.4.1 702 8/23/2017
2.4.0 946 6/1/2017
2.3.0 681 6/1/2017
2.2.0 752 5/10/2017
2.1.0 718 5/5/2017
2.0.0 894 4/26/2017
2.0.0-beta7 644 4/10/2017
2.0.0-beta6 624 3/30/2017
2.0.0-beta5 684 3/30/2017
2.0.0-beta4 641 3/26/2017
2.0.0-beta3 629 3/26/2017
2.0.0-beta2 775 1/25/2017
2.0.0-alpha9 698 1/25/2017
2.0.0-alpha6 1,396 7/29/2016
2.0.0-alpha4 986 2/24/2016
2.0.0-alpha 923 2/7/2016
1.5.4 12,512 7/7/2015
1.5.3 2,641 6/15/2015
1.5.2 2,024 3/22/2015
1.5.1 929 3/10/2015
1.5.0 1,220 3/7/2015
1.4.8 1,450 1/21/2015
1.4.7 896 1/11/2015
1.4.6 2,700 8/30/2014
1.4.5 4,582 5/29/2014
1.4.4 4,811 4/9/2013
1.4.3 981 4/5/2013
1.4.2 952 3/29/2013
1.4.1 941 3/26/2013
1.4.0 956 3/12/2013
1.3.0 1,007 3/11/2013
1.2.0 962 3/8/2013
1.1.0.1 952 3/7/2013
1.1.0 946 3/7/2013