Search

Categories

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Send mail to the author(s) E-mail

# Monday, 06 January 2014
( BitBucket | MVC5 )

There comes a time to just take a deep breath and get on with it:

What am I building

  • Website to display
    • jokes
    • quotes
    • funny videos
    • funny pictures
  • A rating system so any anonymous user can upvote or downvote an item

Why

  • Explore technologies:  TDD, DDD, Refactoring, Patterns eg Repository
  • Work with other people
  • Have something to talk about/demo at user group and conferences
  • Make own professional work better
    • so this is a medium sized architected app that will change it’s requirements over time
  • Have fun
  • Be able to remember jokes

Goal for week1: 

Get project on BitBucket/Github
                 Get an end to end core working
                    use git from command line for source control
                   
                
                    do TDD from outset
                        EF6 CodeFirst, MVC5
                        AutoMapper to map objects to domain objects (dtos) ot not as code first?
                        StructureMap for DI
                       
                    make unit test
                        integration tests
                   
                    make build batch files / automation
                       
                    modular/loosley coupled
                    use mocking
                    use transactions
                    use a generic repository?

 

Start – MVC5 Project

VS2013, New blank solution called Winter.  Then MVC5 project called Winter.Web

image

Right click Add Solution to Source Control.

image
So now there is a .git folder in my windows directory.  Went to bitbucket.org and added a repository called Winter.

image

TDD

image
Getting VS to display the tests when running them.  Sleep trick here to have enough time to get to Test Explorer and pin it while the tests are running.
Ctrl R A – Run all tests using VS MSTest runner.

What describes this list of things

  • jokes
  • quotes
  • funny videos
  • funny pictures

Story – lets go for it and refactor later.

image
Added a reference from Web to Core.

Looking like most unit testing will be against core.

image
Banana joke being displayed via the ViewBag

image
A list of stories on the home page.

// Integration test as going from Web to Core repository.
[TestMethod]
public void Index_GivenNothing_ShouldReturnAListOf3Stories()
{
    HomeController controller = new HomeController();

    ViewResult result = controller.Index() as ViewResult;

    IEnumerable<Story> model = result.Model as IEnumerable<Story>;

    Assert.AreEqual(3, model.Count());
}

First real test of the app.

End to End

Next aim is to get CRUD to the database.  Going to use Repository pattern so can mock out and have fast unit tests on the core. 

PluralsightBook project is a good example – mock unit tests, and integration test, and spikes

| | # 
# Wednesday, 11 December 2013