Search

Categories

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Send mail to the author(s) E-mail

# Saturday, 13 September 2014
( Project )

Strategy is to take a slice through an application ie end to end, and refactor

Paired with DaveH for an hour of coding – great to talk through and refactor code with someone else.

Renaming Stories to Jokes

What started out as a good idea, turned out to be confusing.  As my site principally has ‘jokes’ with a few videos and pictures, it is easier to think of each entity as a ‘Joke’.  So renamed it all through the stack, even to the DB Table.

Pure DI in MVC

image
Simple slice through an app – showing how to do simple DI in MVC, and display 1 table (Jokes).

Have split the Core and Web apart (not really necessary at the moment) – but will need a console app to do imports.

Testing

Unit testing here for fun, to see how good the composed app of disparate parts is.  Whereas I really do like Integration tests. 

Trying to figure out how to easily mock out the Session (FakeSession) so can unit test the services

http://thedatafarm.com/data-access/how-ef6-enables-mocking-dbsets-more-easily/

http://msdn.microsoft.com/en-us/data/dn314431.aspx – shows how to do a test doubles - an in memory collection based on DbSet<T>

at System.Linq.Queryable.OrderBy[TSource,TKey](IQueryable`1 source, Expression`1 keySelector)

image

Something wrong with Queryable in my test double implementation?

IQueryProvider IQueryable.Provider {
    get {
        return null; //return new TestDbAsyncQueryProvider<TEntity>(_query.Provider); }
    }
}

Had commented this out to get rid of Async code – oops.  All works when I implement this.

AddJokes

Ctrl Shift R – Refactor menu in R#.  Pull members up to add to existing interface.

[Fact]
public void AddJoke_GivenTitleAndRating_ShouldSaveToDbAndBeAvailableInTheSession()
{
    var session = new FakeSession();
    var viewer = new JokeViewer(session);

    var result = viewer.AddJoke("sausage", 2);

    Assert.Equal(1, session.Jokes.Count());
    Assert.Equal("sausage", session.Jokes.Single().Title);
    Assert.Equal(2, session.Jokes.Single().Rating);
    Assert.Equal(1, session.SaveChangesCount);
}

Interesting to be able to mock out EF and unit test it.

Class Diagram from Tests Project

image
As the tests project references all the others, then creating a ClassDiagram from it is great, as all the classes are available.

NCrunch

Enabling NCrunch for these Unit tests as they are nice and fast!

Integration Testing

End to end testing and diagram what is going on too.  Bringing in the integration tests.  Referenced EF from tests project, and putting connection string into app.config so R# test runner can connect to the db.

“The model backing the 'Session' context has changed since the database was created. Consider using Code First Migrations to update the database “

    public class Session : DbContext, ISession {
        public Session() : base(nameOrConnectionString: "Funny") {
            // Nice for development
            Database.SetInitializer(new DropCreateDatabaseIfModelChanges<Session>());
        }
        public DbSet<Joke> Jokes { get; set; }
    }

A CodeFirst handy method, so if something changes in the way the db is defined, then the table is auto generated.

image
VS Test runner showing xUnit traits well.  But R# not showing the trait attributes.

http://stackoverflow.com/questions/26042016/resharper-and-xunit-group-by-traits – a question on how to group Traits well in R# test runner.

Integration testing is very nice, however does slow the process down.  Good for the module am working on at the moment.

Multiple Tables

Strategy now is to take old codebase, and merge into new on with DI, Decorator logging and class diagrams…. then look for inspiration from Pluralsight videos.  So aiming towards very testable, maintainable code.

One of the ways to make maintainable code is through loose coupling.  DI enables loose coupling.

OO Composition of Old App

Take old app, and diagram it.

| | # 
# Friday, 10 January 2014
( MVC5 | Project )

Going through sample projects to build up Winter.

image
Custom logic on the model to not allow any Title called Dave.

[Required]
[Range(0, 9999, ErrorMessage = "Rating should be in the range of 0 to 9999")]
public int Rating { get; set; }

public System.Collections.Generic.IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
    if (Title == "Dave")
    {
        yield return new ValidationResult("Sorry you can't do this Dave");
    }
}

In class Story which implements IValidateableObject

EF CodeFirst without automatic? migrations.  When I was trying to easily reset the db

 http://www.itorian.com/2012/10/entity-frameworks-database-seed-method.html

image

public Configuration()
{
    AutomaticMigrationsEnabled = true;
    AutomaticMigrationDataLossAllowed = true;
}

Then added this, so live kicks in again.

Unit Testing the Controller

http://geekswithblogs.net/Frez/archive/2013/04/26/unit-testing-an-asp.net-mvc-4-controller-using-ms-test.aspx

He is being very fastidious testing the controller.   But it i is almost testing MVC.

 

Put your controllers on a Diet!

http://www.viddler.com/v/b568679c

 

ContosoUniversity

http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/creating-an-entity-framework-data-model-for-an-asp-net-mvc-application

image
Interesting UI.  Done very simply with a table and overloaded index method.

image
Filtering, Paging and Sorting.

No testing.  Interesting logger.  InstructorIndexViewModels are lists of Instructors/Courses.Enrollments

Uses migrations (not auto)

EF Power Tools

http://visualstudiogallery.msdn.microsoft.com/72a60b14-1581-4b9b-89f2-846072eff19d

For creating db diagram

Holistic Testing – Jimmy Bogard: Holistic Testing

From London NDC 2013:

http://vimeo.com/68390508

redux of putting controllers on a diet:

1. http://lostechies.com/jimmybogard/2013/10/10/put-your-controllers-on-a-diet-redux/

2. http://lostechies.com/jimmybogard/2013/10/22/put-your-controllers-on-a-diet-defactoring/

3. http://lostechies.com/jimmybogard/2013/10/23/put-your-controllers-on-a-diet-a-survey/

4. http://lostechies.com/jimmybogard/2013/10/29/put-your-controllers-on-a-diet-gets-and-queries/

5. http://lostechies.com/jimmybogard/2013/12/19/put-your-controllers-on-a-diet-posts-and-commands/

| | # 
# Thursday, 09 January 2014
( EF6 | MVC5 | Project )

Looking at admin interface and how to handle foreign keys / drop downs.

@*@Html.DropDownList("StoryTypeID", String.Empty)*@
@Html.DropDownList("StoryTypeID")

Getting rid of the blank type in the dropdown list.

image

image

image

image
The standard first deployment screen!

  <system.web>
    <authentication mode="None" />
    <compilation debug="true" targetFramework="4.5.1" />
    <httpRuntime targetFramework="4.5.1" />
    <customErrors mode="Off"/>
    
  </system.web>

Added customErrors into web.config.. and suddenly it broke into life.  Hmm – initially a timeout.  Took customErrors out and it still works.

image
A working app.  Important.

Deploying and Cleaning up

Because I’d like to really encourage collaboration in teams I’m going to be as open as possible and put this code on GitHub.

I’ve got lots of commits and legacy code in current local git repo, but only want to push up current.  Basically tidy up.

image
Don’t want this publish profile in github.

image
Thats all we need – in fact don’t need packages, as NuGet would get these anyway.

http://robertcorvus.com/visual-studio-command-to-delete-all-bin-and-obj-folders-in-solution/

##########################################################
# PLEASE READ:
#
# This script will be loaded by Visual Studio only when
# the solution is loaded therefore any changes you make
# to it will not be effective until after you exit Visual
# Studio and reload the solution.
##########################################################
function global:DeleteBinObj()
{
    Get-ChildItem .\ -include bin,obj -recu -Force | remove-item -force -recurse
}
image

image

image
This was with no packages from NuGet.

image
This seems excessive – EF is 30MB

image
Found that I was referencing EF6.0.0 in web and 6.0.2 in test.  So upgraded web (which seems to have speeded startup time of project up)

Driving Out From Tests

So have got:

  • Rudimentary framework (I suspect will need to refactor out into separate projects Web and Core.. but not yet)
  • Source controlled on GitHub
  • Working live on: http://britishhumour.azurewebsites.net/
  • 6 passing tests – a few integration

Want to make sure current site is ‘working’, and want to drive out functionality from tests now.

tried to test WinterDb directly from tests class for Integration testing:

Error    1    The type 'Microsoft.AspNet.Identity.EntityFramework.IdentityDbContext`1<T0>' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.AspNet.Identity.EntityFramework, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.    E:\Dev\Winter Project\Winter\Winter.Web.Tests\Repository\StoryRepositoryTests.cs    20    17    Winter.Web.Tests

Its because I’m using IdentityDbContext and shortcutting.. Hmm.  Used NuGet to get around this.

Currently all logic is in Model (good) and Controller (just for UI rendering, so that is fine).

Made context Sets virtual to help with lazy loading and change tracking.

Making admin screen – changing size of input boxes

All done with Bootstap3

http://www.mytecbits.com/microsoft/dot-net/bootstrap-3-with-asp-net-mvc-5

Adding content and using the site

image

Layout work will have to be done soon.

image

image

Admin interface coming together.

| | # 
# Wednesday, 08 January 2014
( EF6 | MVC5 | Project )

Am using the database in Winter.Web\App_Data\Winter.mdf and using

<connectionStrings>
    <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\Winter.mdf;Initial Catalog=Winter;Integrated Security=True" providerName="System.Data.SqlClient" />
  </connectionStrings>

However in the test project the |DataDirectory| is in Winter.Web.Tests so need to point to Winter.Web directory

<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=e:\\dev\\winter project\\winter\\winter.web\\app_data\\Winter.mdf;Initial Catalog=Winter;Integrated Security=True" providerName="System.Data.SqlClient" />

This works but relative would be much better.  Stick with this for now as it works.

photo

Initial sketch of front page (and only real page)

image
As all in 1 project can use trick to pull the ApplicationDbContext used for authentication into WinterDb

@if (User.IsInRole("admin"))
{
    <li>@Html.ActionLink("Admin", "Index", "Story")</li>
}

Menu now reacts if the users is in admin role or not.

image

image
Mocking out the front end.

image
Beginnings of an admin interface.

Working on foreign keys and drop downs working.

image
A useful trick is to get the model sorted out, then do an Add Controller (and associated views) which gives a good starting point.

| | # 
# Tuesday, 07 January 2014
( EF6 | MVC5 | Project )

Enabling migrations – have currently got a POCO:

namespace Winter.Core.Model
{
    public class Story
    {
        public int StoryID { get; set; }
        public string Title { get; set; }
        public string Content { get; set; }
    }
}

Install EF into Infrastructure

ALT V E O to get package manager console up

Enable-migrations

Change

Update-database to kick it into life

Ended up looking at Azure again, and it has stopped working (free trial ended).. but didn’t roll over into a paid one.  And credit card wouldn’t work.

image

Set startup project to Infrastructure! To get update-database –verbose to use that (instead of web project) or

Enable-Migrations -ContextTypeName Web.Infrastructure.ContextName

Bring together Core and Infrastructure projects?

http://stackoverflow.com/questions/14891640/implementing-bounded-context-to-entity-framework-based-infrastructure

“Assuming you have a complex business domain and significant business logic, it can be worth making the effort as you have to isolate your domain layer from infrastructure concerns. However, this is often not the case. If you are mostly just moving data from the database to the UI and back again, then this is overengineering and you should seek something with fewer moving parts.”

Don’t need to isolate and test infrastructure currently as it is just EF.

What are we testing?

The main goal of this project is to drive it out via testing.  So goal is to have many unit tests which are totally independent.

Want a fat model and skinny controller.

Use interfaces

Telerik JustMock

namespace Winter.UnitTests.Web
{
    [TestClass]
    public class WinterUnitTests
    {
        // Unit test as injecting in a fake repository
        [TestMethod]
        public void Index_GivenAFakeRepository_ShouldReturnAListOfAllStories()
        {
            var storyRepository = Mock.Create<IStoryRepository>();
            Mock.Arrange(() => storyRepository.GetAllStories())
                .Returns(new List<Story>()
                {
                    new Story { StoryID=1, Title="title1", Content="content1"},
                    new Story { StoryID=2, Title="title2", Content="content2"}
                })
                .MustBeCalled();

            // Act
            HomeController controller = new HomeController(storyRepository);
            ViewResult result = controller.Index() as ViewResult;
            IEnumerable<Story> model = result.Model as IEnumerable<Story>;

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

however much more elegant? is to have our own fake

Do we really need a repository pattern over it all, as have EF?

CTRL R + CTRL T – run current test

[TestMethod]
public void StoriesDb_GivenANewStory_ShouldSaveToDb_AndThenRevertBackDB()
{
    using (var db = new StoryRepository())
    {
        var story = new Story { Title = "test", Content = "testcontent" };

        db.Stories.Add(story);
        db.SaveChanges();

        var result = db.Stories;

        Assert.AreEqual(4, result.Count());

        db.Stories.Remove(story);
        db.SaveChanges();
        Assert.AreEqual(3, result.Count());
    }
}

Integration testing the repository.  Also implemented the transactional stuff so don’t need to remove.

Starting to build up domain model:

public class Story
{
    public int StoryID { get; set; }

    [Required]
    public string Title { get; set; }
        
    public string Content { get; set; }
}

Simplify

From Scott Allen’s code http://pluralsight.com/training/Courses/TableOfContents/mvc4-building I’ve simplified the project even further to see if it’s robust enough to do the job.

So now I’ve got a Web project and a Tests project.

image

| | # 
# Sunday, 20 October 2013
( Project )

Connecting to a DB…

public partial class Test : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            const string connectionString = @"server=.\SQLEXPRESS;database=TestDB;Trusted_Connection=True;";

            using (var connection = new SqlConnection(connectionString))
            {
                connection.Open();
                using (var command = new SqlCommand("SELECT Name FROM Countries", connection))
                {
                    using (var reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            TextBox1.Text += reader.GetString(0) + ", ";
                        }
                    }
                }
            }
        }
    }

image

Only thing worse would be putting the code inline.

Next step is to put the config somewhere else so don’t have to DRY – Don’t Repeat Yourself

protected void Page_Load(object sender, EventArgs e)
{
    using (var connection = new SqlConnection(WebConfigurationManager.ConnectionStrings["DaveConnection"].ToString()))
    {
        connection.Open();
        using (var command = new SqlCommand("SELECT Name FROM Countries", connection))
        {
            using (var reader = command.ExecuteReader())
            {
                while (reader.Read())
                {
                    TextBox1.Text += reader.GetString(0) + ", ";
                }
            }
        }
    }
}
<configuration>
    <system.web>
      <compilation debug="true" targetFramework="4.5" />
      <httpRuntime targetFramework="4.5" />
    </system.web>

  <connectionStrings >
    <add name="DaveConnection" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=TestDB;Integrated Security=True;" providerName="System.Data.SqlClient" />
  </connectionStrings>

</configuration>
| | # 
# Saturday, 06 November 2010
( Linq | Project )

A windows forms project, with a testing project.  Uses VS2010 and .NET4.  Probably ok with 3.5.

The code is really this:

public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
UniqueSpike uniqueSpike = new UniqueSpike();
string messageToDisplay = uniqueSpike.DoChecking();
textBox1.Text = messageToDisplay;
}
}

public class UniqueSpike
{
public string DoChecking()
{
List<thing> listOfThings = SetupTestDataAndAddToList();
List<thing> result = SeeIfAnyInListHaveAUniqueColour(listOfThings);
List<thing> result1 = SeeIfAnyInListAreUniqueByPosition(listOfThings);
List<thing> result2 = SeeIfAnyInListAreUniqueByHeight(listOfThings);
string results = "Single Column Uniqueness" + Environment.NewLine;
foreach (thing thing in result)
results += thing.Name + " becuase its colour is " + thing.Colour + Environment.NewLine;
foreach (thing thing in result1)
results += thing.Name + " becuase its position is " + thing.Colour + Environment.NewLine;
foreach (thing thing in result2)
results += thing.Name + " becuase its height is " + thing.Colour + Environment.NewLine;

results += Environment.NewLine + "Double Column Uniqueness - Colour and Position" + Environment.NewLine;
List<thing> result3 = SeeIfAnyInListAreUniqueByColourAndPosition(listOfThings);
foreach (thing thing in result3)
results += thing.Name + " becuase its colour is " + thing.Colour + " and its position is " + thing.Position + Environment.NewLine;

return results;
}

public List<thing> SetupTestDataAndAddToList()
{
thing thing0 = new thing { Name = "0", Colour = "red", Position = "left", Height = "short" };
thing thing1 = new thing { Name = "1", Colour = "red", Position = "left", Height = "tall" };
thing thing2 = new thing { Name = "2", Colour = "blue", Position = "middle", Height = "short" }; // unique colour and position
thing thing3 = new thing { Name = "3", Colour = "blue", Position = "left", Height = "short" }; // unique colour and position
thing thing4 = new thing { Name = "4", Colour = "green", Position = "right", Height = "medium" }; // unique position right
thing thing5 = new thing { Name = "5", Colour = "green", Position = "middle", Height = "tall" }; // unique colour and position
thing thing6 = new thing { Name = "6", Colour = "orange", Position = "left", Height = "medium" }; // unqiue colour orange
thing thing7 = new thing { Name = "7", Colour = "gold", Position = "left", Height = "medium" }; // unqiue colour gold
List<thing> listOfThings = new List<thing>();
listOfThings.Add(thing0);
listOfThings.Add(thing1);
listOfThings.Add(thing2);
listOfThings.Add(thing3);
listOfThings.Add(thing4);
listOfThings.Add(thing5);
listOfThings.Add(thing6);
listOfThings.Add(thing7);
return listOfThings;
}

public List<thing> SeeIfAnyInListHaveAUniqueColour(List<thing> listOfThings)
{
IEnumerable<IGrouping<string, thing>> thingQuery2 = from t in listOfThings
group t by t.Colour;
List<thing> listOfThingsFound = new List<thing>();
foreach (var thingGroup in thingQuery2)
{
Console.WriteLine(thingGroup.Key);
if (thingGroup.Count() == 1)
{
foreach (thing thing in thingGroup) // there is only going to be 1
listOfThingsFound.Add(thing);
}
}
return listOfThingsFound;
}

public List<thing> SeeIfAnyInListAreUniqueByPosition(List<thing> listOfThings)
{
IEnumerable<IGrouping<string, thing>> thingQuery2 = from t in listOfThings
group t by t.Position;
List<thing> listOfThingsFound = new List<thing>();
foreach (var thingGroup in thingQuery2)
{
Console.WriteLine(thingGroup.Key);
if (thingGroup.Count() == 1)
{
foreach (thing thing in thingGroup) // there is only going to be 1
listOfThingsFound.Add(thing);
}
}
return listOfThingsFound;
}

public List<thing> SeeIfAnyInListAreUniqueByHeight(List<thing> listOfThings)
{
IEnumerable<IGrouping<string, thing>> thingQuery2 = from t in listOfThings
group t by t.Height;
List<thing> listOfThingsFound = new List<thing>();
foreach (var thingGroup in thingQuery2)
{
Console.WriteLine(thingGroup.Key);
if (thingGroup.Count() == 1)
{
foreach (thing thing in thingGroup) // there is only going to be 1
listOfThingsFound.Add(thing);
}
}
return listOfThingsFound;
}

public List<thing> SeeIfAnyInListAreUniqueByColourAndPosition(List<thing> listOfThings)
{
List<thing> listOfThingsFound = new List<thing>();
// grouping by multiple columns as anonymous type
var thingQuery5 = from t in listOfThings.AsEnumerable()
group t by new { colour = t.Colour, position = t.Position } into groupedTable
select new
{
x = groupedTable.Key,
y = groupedTable.Count()
};

foreach (var thing in thingQuery5)
{
if (thing.y == 1) // if there is only 1 record for this colour and position
{
// want to search for the record and add it to a list to return
thing uniqueThingByColourAndPosition = (from t in listOfThings
where (t.Colour == thing.x.colour) && (t.Position == thing.x.position)
select t).Single();
listOfThingsFound.Add(uniqueThingByColourAndPosition);
}
}
return listOfThingsFound;
}
}

public class thing
{
public string Name { get; set; }
public string Colour { get; set; }
public string Position { get; set; }
public string Height { get; set; }
}

and testing code:

[TestClass]
public class UnitTest1
{
[TestMethod]
public void CheckThatNumber6IsUniqueBecauseItIsColourOrange()
{
UniqueSpike uniqueSpike = new UniqueSpike();
List<thing> listOfThings = uniqueSpike.SetupTestDataAndAddToList();
List<thing> result = uniqueSpike.SeeIfAnyInListHaveAUniqueColour(listOfThings);
foreach (thing thing in result)
{
if (thing.Name == "6")
{
thing whatExpecting = new thing { Name = "6", Colour = "orange", Position = "left", Height = "medium" };
Assert.AreEqual(whatExpecting.Colour, thing.Colour);
Assert.AreEqual(whatExpecting.Position, thing.Position);
Assert.AreEqual(whatExpecting.Height, thing.Height);
}
}
}

[TestMethod]
public void CheckThatNumber7IsUniqueBecauseItIsColourGold()
{
UniqueSpike uniqueSpike = new UniqueSpike();
List<thing> listOfThings = uniqueSpike.SetupTestDataAndAddToList();
List<thing> result = uniqueSpike.SeeIfAnyInListHaveAUniqueColour(listOfThings);
foreach (thing thing in result)
{
if (thing.Name == "7")
{
thing whatExpecting = new thing { Name = "7", Colour = "gold", Position = "left", Height = "medium" };
Assert.AreEqual(whatExpecting.Colour, thing.Colour);
Assert.AreEqual(whatExpecting.Position, thing.Position);
Assert.AreEqual(whatExpecting.Height, thing.Height);
}
}
}

[TestMethod]
public void CheckThatNumber4IsUniqueBecauseItIsPositionRight()
{
UniqueSpike uniqueSpike = new UniqueSpike();
List<thing> listOfThings = uniqueSpike.SetupTestDataAndAddToList();

List<thing> result = uniqueSpike.SeeIfAnyInListAreUniqueByPosition(listOfThings);
foreach (thing thing in result)
{
if (thing.Name == "4")
{
thing whatExpecting = new thing { Name = "4", Colour = "green", Position = "right", Height = "medium" };
Assert.AreEqual(whatExpecting.Colour, thing.Colour);
Assert.AreEqual(whatExpecting.Position, thing.Position);
Assert.AreEqual(whatExpecting.Height, thing.Height);
}
}
}

[TestMethod]
public void CheckThatNoneAreReturnedForUniqueHeight()
{
UniqueSpike uniqueSpike = new UniqueSpike();
List<thing> listOfThings = uniqueSpike.SetupTestDataAndAddToList();
List<thing> result = uniqueSpike.SeeIfAnyInListAreUniqueByHeight(listOfThings);
foreach (thing thing in result)
{
Assert.IsFalse(1 == 1); // just throwing an error if it gets here
}
}

[TestMethod]
public void CheckThat_2_3_4_5_6_7_RecordsAreReturnedForColourAndPositionUniqueness() // only doing number 2 so far here
{
UniqueSpike uniqueSpike = new UniqueSpike();
List<thing> listOfThings = uniqueSpike.SetupTestDataAndAddToList();
List<thing> result = uniqueSpike.SeeIfAnyInListAreUniqueByColourAndPosition(listOfThings);
thing thing2 = result.Find(delegate(thing thing)
{
if (thing.Name == "2")
{
return true;
}
return false;
});
Assert.IsNotNull(thing2);

}
}

| | #