Open Frikki opened 10 years ago
Can you put the code you want to test in a portable class library and then reference that from a normal class library which has Bddfy in it?
I downloaded the TestStack.BDDfy-master, opened the solution, changed the target framework for the TestStack.BDDfy class library project to .Net Framework 4.5.1 and ran Build Solution.
Then in my own portable class library targeting Windows 8.1 and Windows Phone 8.1, I am able to reference the newly built TestStack.BDDfy.dll successfully.
I have tested successfully with:
using NUnit.Framework;
namespace BDDfy.MethodNameConventions
{
[TestFixture]
public class BDDfyRocks
{
[Test]
public void ShouldBeAbleToBDDfyMyTestsVeryEasily()
{
this.BDDfy();
}
void GivenIHaveNotUsedBDDfyBefore()
{
}
void WhenIAmIntroducedToTheFramework()
{
}
void ThenILikeItAndStartUsingIt()
{
}
}
}
Just had a quick look into this.
To support PCL with compatibility of .net 4.0, windows 8 and windows phone 8.1 we need to:
Console
or remove console reporter (maybe make it trace reporter?). We might lose colors which should be fine as r# and nCrunch don't show that anywaysSystem.Web.HttpUtility.HtmlEncode()
is not available, we will need a new way to encode titles in htmlDateTime.ToShortDateString()
doesn't exist, we need to just use .ToString and a format to get it backJsonSerializer
needs to be reimplemented, as there is no built in Json serialisation in PCL.Those are the main problems I can see. I don't have time to do this before the 4.0.0 release, but if you want to take a look @Frikki and submit a pull request I can see no reason why it wouldn't be accepted.
We do not want to raise the minimum compatibility to 4.5.1, and have no idea why that is allowed anyways (PCL referencing a .net 451 library?). So the only way we will add this is to switch BDDfy to a PCL library itself.
The level of PCL will have to be kept quite high as well, to a profile which supports compiling expression trees.
"have no idea why that is allowed anyways (PCL referencing a .net 451 library?)"
Yeah, but why can a PCL reference a .net 451 library. The other way around sure, but you said you simply changed to .net 451 and it could be used/referenced?
Yes, I changed the target framework for the TestStack.BDDfy class library project and rebuilt it. It now works flawlessly (still) with my win81 and wpa81 development.
Way back in V1, the framework (at the time called bddify) had support for SilverLight and Windows Phone 7. I basically had the same code with conditional compilation for each platform/framework and a multi-platform nuget. The problem with SL and WP (at least back then) was that they had next to zero support for expression trees which meant there was NO Fluent API for these platforms. FWIW at the time most of the reports were implemented using trace reporters; but still some of the reports didn't work. Admittedly I am completely clueless about anything XAMLy so I got a few SL experts to look at it and they said that was as far as I could go with it.
We could try to make this PCL which might result into a more tolerable outcome; but as @JakeGinnivan mentioned there are a few complications.
Sadly!