SpecFlow and Xamarin Studio Integration with Custom Templates - specflow

I'm currently looking at using SpecFlow in conjunction with Xamarin Studio for writing BDD tests for cross-platform mobile apps.
I've been using the Xamarin Studio add-in developed here https://github.com/mikeyjones/SpecFlow to integrate SpecFlow into the IDE.
What I need to be able to do is add some extra steps into the process when a new feature file is created, namely to create a new file to hold additional code I need in the feature class.
So I would end up with,
NewFeature.feature
NewFeature.feature.cs (code-behind defining partial class)
NewFeature.cs (where I add additional code to the partial class)
I also need to be able to add some additional code to the template that creates the step definitions for the feature.
The above repo contains the code that is currently producing the new files but I'm struggling to understand how this works in order to figure out how to integrate with it to add my own additions.
Can anyone point me in the right direction to achieve this?

Related

Adding Azure Single-Sign-On to an existing MVC application, in VS2013

I've been exploring the Azure Active Directory services and was pleased with how easy it was to hook up an arbitrary ASP.NET MVC website to it. I've experimented with this in Visual Studio 2012 and all works well. Especially using the Identity and Access Tool extension for VS2012.
Now here comes the tricky part: This tool is however deprecated and not supported on, nor available for Visual Studio 2013.
There are several MSDN documents on the matter, like this excellent tutorial, only I find them all targeting VS2012 and the forementioned tool. For new projects the process is "simplified when creating a new web application". But I don't want a new application - I want to hook up existing applications in VS2013.
Now the question is: is there a 'decent' way to integrate Azure ActiveDirectory, especially the Single Sign-On feature, to an existing ASP.NET MVC 5 web application in Visual Studio 2013?
At least with the same ease as the I&A Tool, but without the need to recreate or migrate my entire application, of course.
Depending on the complexity of your project, you can either create a new project and import your project files to the new project or import the identity settings to your existing project.
Since the identity controls are really just a set of files and configuration, you should be able to create a project with the identity settings you want and then copy over the files / configuration to your existing project. You may also need to add references to things like Microsoft.AspNet.Identity.Owin and any security providers you need. Files to take a look at include:
App_Start/IdentityConfig.cs
App_Start/Startup.Auth.cs
Controllers/AccountController.cs
Startup.cs
Web.config
Yes, it's a pain, and hopefully there will be an easier way of adding or changing identity later, but this is the best I've come up with for now.

Debugging a nuget of an entire web installed into an empty web app

We are in the middle of development for a core ASP.NET MVC web project and a customer plugin in the form of an MvcContrib plugin web project -- a web project injected into the core web as an area. The plugin is a soft reference in the core project, so it can be developed completely separately and dropped in.
I am trying to generate a way to debug/code the plugin, so that the multiple custom plugins can be developed independent of the core web.
The developers should only have to worry about coding and testing the plugin code. Also, I don't want them to change the core code in this custom plugin project -- that should be done in the core anyway.
I created the core web as a NuGet package and included all the necessary files so I could include it in a web.
My thinking was that I could create an empty web, install my core web, and the developers could have an F5-driven debugging environment.
I tested by creating a blank Mvc project, installed my core package and included one of my plugins. I changed the namespace of this empty web app to the namespace of the core web, thinking that Visual Studio debugging would properly attach and my core assembly.
Simple VS debugging in the empty app does not work -- I receive an HTTP Exception, most likely due to my routes not being registered. I also see that my log4net is not creating its logs folder, so I know the assembly's app start is not being called.
So I see that VS is not attaching to and calling my core assembly.
Can I use this empty web as a host project for my nuget installed web and debug? If so, what configuration am I missing?
If not, how can I include the core web in each customer plugin project in such a way that I can drop my DLL into the bin and debug it?
Using:
Visual Studio 2010
ASP.NET MVC2
The way we are doing things that works pretty well is to use a combination of Web Activator and Razor Generator (available as a Visual Studio extension). In order to access the views within the core web application, the consuming client application needs to know about them, either because they are all included as file references inside the Nuget package (messy) or because they are compiled into the core web dll. You can do that using Razor Generator. Once installed via Nuget you would need to change the Custom Tool property for each .cshtml file to RazorGenerator, which will create a .generated.cs file for each view. This will allow your sample client to use the layout and views from the core web application.
David Ebbo has some useful blog posts on Razor Generator
Couple that with Web Activator to create a PostActivationStartMethod that runs your initialisation code (such as initialising Log4Net) and you should be good to go. We've had this running in 2 scenarios - consuming the framework package via Nuget and adding a project reference directly. Debugging was not working for the Nuget package consuming route but we don't include the pdb files in the Nuget package. We can debug when adding a project reference directly though.

Add xUnit test project to an existing Visual Web Developer 2010 express MVC application

Maybe it's very easy but I'm trying to add support for xUnit in Visual Web Developer 2010 Express. I followed this tutorial on how to install everything but the main problem is that this tutorial only show how to add a test project to a new project and not to an existing one. When I do "Add New Project", there is not "xunit" or "test project" anywhere...
Anybody know how or can point me to a good tutorial?
A standard Windows Library (.DLL) project will work fine and is the normal project type used for xUnit.net Tests - all the existing mechanism really added was the inclusion of some example tests to start you off.
This (not having templates) is the approach being taken with future xUnit versions. You'll find some discussion of the reasoning behind this on http://xunit.codeplex.com/discussions

how to add mvc test project to upgraded web application

I have an existing asp.net web application that I'm updating to include some MVC pages. I have successfully upgraded the web app to recognize my MVC controllers/views/... I can even get my test page to display correctly: hooray!
However, I am having trouble figuring out how to add a test project so that I can add my unit tests for the new pages. Does anyone have a suggestion on how to achieve this goal?
If you are using MSTest right click on the solution and Add -> New Project.... Select Test Project type. In the newly created project reference the project containing the controllers and start adding unit tests.
If you are using some 3rd party unit testing framework such as NUnit you could add a project of type Class Library and then add the unit tests to this class library.

ASP.NET MVC - Script Combine

The ASP.NET team released the script combining feature in 3.5 SP1 as detailed here http://www.asp.net/Learn/3.5-SP1/video-296.aspx. Is there a similar feature already for the MVC framework? If not, is this in scope or is it possible to somehow leverage the webforms capability in MVC? I see this site uses a custom jquery.package.master which, I assume, they have rolled themselves (maybe into the build cycle, however it is not all minified therefore I think they have manually appended the scripts together rather than some automated minify & combine task). Would be interested in any ideas how to accomplish this in MVC but I dont want to begin rolling any of my own functionality in case I will be duplicating work in progress.
Here's what I do, in case it's helpful.
In my postbuild I call a command line version of Dean Edwards's Packer. It combines the scripts and packs them for me.
For now though, I keep all of my stuff seperate and use a Helper method to include my scripts, and if the debug flag is not present it will include the packed versions, otherwise it includes the unpacked.
Another option is in the Telerik Native UI Extensions for MVC (free library and open source), called ScriptRegistar. It will combine and compress javascript for you, and is fairly feature rich. There is also a class for doing the same to css as well.
I am using this to combine +20 javascript files into one file which is downloaded by the browser.
http://www.telerik.com/products/aspnet-mvc.aspx and you can get it via NuGet.
Every day there is a different way of doing things and the techniques changes.
At this time there is a very good Nuget Package released in CodePlex.
Combres - WebForm & MVC Client-side Resource Combine Library
http://combres.codeplex.com/
http://weblogs.asp.net/gunnarpeipman/archive/2009/07/04/asp-net-mvc-how-to-combine-scripts-and-other-resources.aspx

Resources