I currently have the requirement to set the Request.AcceptTypes property for a controller test.  AFAIK there is currently no way of doing this within the MVC-Contrib TestControllerBuilder.

I updated their latest trunk and have created a patch file in case you, or the MVC-Contrib guys want to use it.

Heres the test:

        [Test]
        public void CanSpecifyRequestAcceptTypes()
        {
            builder.AcceptTypes = new[] {"some/type-extension"};
            var controller = new TestHelperController();
            builder.InitializeController(controller);
            Assert.That(controller.HttpContext.Request.AcceptTypes, Is.Not.Null);
            Assert.That(controller.HttpContext.Request.AcceptTypes.Length, Is.EqualTo(1));
            Assert.That(controller.HttpContext.Request.AcceptTypes[0], Is.EqualTo("some/type-extension"));
        }

 

Heres the code

		protected void SetupHttpContext()
		{
			...
SetupResult.For(request.AcceptTypes).Do((Func<string[]>)(() => AcceptTypes));

.....
		}

Download the patch: click here

 

Dave the Ninja


Stage 1 of the move complete

20 Apr 2009 In: Hong Kong

As of sunday evening all of my domains were successfully moved to GANDI.net

Next on the agenda is getting my old clients sites off my servers and on to their own hosting plans.

 


Windows 2008 Server, your days are numbered!

15 Apr 2009 In: Hong Kong

It is with great joy *achem* regret that I am getting rid of my dedicated servers over the next few weeks.

The main reason is cost, and limitations. I have decided to get hosting from now on, on a project per project basis, with my domains hosted over on GANDI.net

I will be re-doing my blog within the next week or so over to a Ruby on Rails blog engine - and I will/should be moving my site over to brightbox.com for hosting.

Hopefully this will be quite easy to do *fingers crossed* and should not interupt the site too much.

I will blog on my experiences after its complete

Ninja


Official launch of www.richpictures.co.uk

1 Apr 2009 In: C# 3.5, Family, MVC.net

I had been working for some time on a project for my friends company Rich Pictures Ltd, who are based in Glasgow - Scotland (UK)


The site had been up and running for quite a while as we ironed out the remaining features such as the shop and PayPal integration but on Monday I flicked the switch and rolled over to the final release of this application.

 

 

The website is designed to showcase the works of Lisa Clelland, and to enable her to clients to log in and select which photographs they would like prints of and then add them to cart for purchasing.

 I am really happy how this site has evolved and with the design of the site. This was a 1 man job from start to finish, working closely with Rich Pictures throughout the design processes

 

 

I twittered on it and have received some lovely comments so far, two of which were from Phil Haack (Microsoft MVC) and Louis DeJardin (Spark View Engine Creator)

I see big things for the future of this site and company as a whole as Lisa is a very talented photographer, as you can see from looking at the site.


You can visit Rich Pictures at www.richpictures.co.uk or contact Lisa directly on 07786 077 891 if you are interested in booking her (quote you got the link/number from me)

Dave the Ninja

 


About this blog

Dave the Ninja is an Alt.net practitioner from Glasgow in Scotland (UK). He rants about all things from coding to Kung Fu with some swearing thrown in for good measure.

Dave the Ninja has been programming professionally with Microsoft technologies for the past 9 years starting and is now working primarily with C# 3.5, MVC.net and Resharper.

Dave the Ninja has been practicing Chinese internal arts for the past 15 and a half years, mainly Taiji Quan, Neijia Quan , Chi Na and Qigong.

I have joined Anti-IF Campaign

My Communities/Projects

Flickr PhotoStream


Sponsors