ExpressionToCodeLib 3.5.0

.NET 6.0 .NET Standard 2.0
dotnet add package ExpressionToCodeLib --version 3.5.0
NuGet\Install-Package ExpressionToCodeLib -Version 3.5.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ExpressionToCodeLib" Version="3.5.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ExpressionToCodeLib --version 3.5.0
#r "nuget: ExpressionToCodeLib, 3.5.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ExpressionToCodeLib as a Cake Addin
#addin nuget:?package=ExpressionToCodeLib&version=3.5.0

// Install ExpressionToCodeLib as a Cake Tool
#tool nuget:?package=ExpressionToCodeLib&version=3.5.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.

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48 net481
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (7)

Showing the top 5 NuGet packages that depend on ExpressionToCodeLib:

Package Downloads
ProgressOnderwijsUtils

Collection of utilities developed by ProgressOnderwijs

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(); ```

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 Downloads Last updated
3.5.0 808 8/19/2022
3.4.1 474 5/23/2022
3.4.0 7,774 2/21/2021
3.3.0 26,985 9/12/2019
3.2.0 12,886 2/10/2019
3.1.0 19,318 7/10/2018
3.1.0-alpha 964 7/10/2018
3.0.0 11,352 6/27/2018
3.0.0-beta1 973 6/26/2018
3.0.0-alpha4 937 6/15/2018
3.0.0-alpha3 950 6/15/2018
3.0.0-alpha2 972 6/12/2018
3.0.0-alpha1 981 6/3/2018
2.7.0 39,329 2/19/2018
2.6.0 1,214 2/16/2018
2.6.0-signed 1,064 2/16/2018
2.5.1 11,656 10/30/2017
2.5.0 1,447 9/20/2017
2.4.1 1,176 8/23/2017
2.4.0 1,433 6/1/2017
2.3.0 1,142 6/1/2017
2.2.0 1,220 5/10/2017
2.1.0 1,187 5/5/2017
2.0.0 2,115 4/26/2017
2.0.0-beta7 969 4/10/2017
2.0.0-beta6 959 3/30/2017
2.0.0-beta5 1,010 3/30/2017
2.0.0-beta4 981 3/26/2017
2.0.0-beta3 972 3/26/2017
2.0.0-beta2 1,112 1/25/2017
2.0.0-alpha9 1,024 1/25/2017
2.0.0-alpha6 2,047 7/29/2016
2.0.0-alpha4 1,717 2/24/2016
2.0.0-alpha 1,258 2/7/2016
1.5.4 17,700 7/7/2015
1.5.3 3,103 6/15/2015
1.5.2 2,947 3/22/2015
1.5.1 1,430 3/10/2015
1.5.0 1,672 3/7/2015
1.4.8 2,022 1/21/2015
1.4.7 1,488 1/11/2015
1.4.6 3,509 8/30/2014
1.4.5 5,370 5/29/2014
1.4.4 6,098 4/9/2013
1.4.3 1,495 4/5/2013
1.4.2 1,461 3/29/2013
1.4.1 1,457 3/26/2013
1.4.0 1,458 3/12/2013
1.3.0 1,502 3/11/2013
1.2.0 1,460 3/8/2013
1.1.0.1 1,479 3/7/2013
1.1.0 1,454 3/7/2013

Add support for throw expressions (thanks @girlpunk)