MVC planning poker -Test driven development and Version control and Continuous Integration– foundation – 2

After setting the use cases, I have now think about code. ( Ok, maybe it should be first architecture, but I am a programmer first )

So I start to code the first Use case :

 
public class UseCase1CreateTable
    {
        [TestMethod]
        public void UseCase1RightPath()
        {
            var ModeratorName = "ignat andrei";
            var roundName = "UseCase1 - Create Table";
            var table = TableFactory.CreateTable(ModeratorName);
            table.AddDuration(1);
            table.AddDuration(2);
            table.AddDuration(3);
            table.AddRoundName(roundName);
            
            Assert.AreNotEqual(0,table.Id.Length);
            Assert.AreEqual(true,table.CanAddUser);
            Assert.AreEqual(ModeratorName,table.ModeratorName);
            Assert.AreEqual(1,table.Rounds.Length);
            Assert.AreEqual(roundName, table.Rounds[0].Name);


        }
    }
 

Running the test was a no-brainer – it does not even compile. And it is good, according to https://msdn.microsoft.com/en-us/library/aa730844(v=vs.80).aspx 

Now I want to test the code, so I created the classes and now the  tests were all red (because there is nothing implemented yet, just compiling) . A hour and all is going smoothly until the test was green – http://en.wikipedia.org/wiki/Test-driven_development

Now the point is to enforce this behavior every time the programmer checks in some code.

So I think about Visual Studio Online – to test if , aside Version Control, it can help me with running test.

And yes, they have builds.And, being the single contributor to this project, I choose Gated Checkins

image

 

Now every time I check-in some code, the build will start and see what’s happening.

The code is at https://ignatandrei.visualstudio.com/DefaultCollection/MVC%20Planning%20Poker 

Exercise  for home:

Do you spot what is missing from
this test code ?

 
public class UseCase1CreateTable
    {
        [TestMethod]
        public void UseCase1RightPath()
        {
            var ModeratorName = "ignat andrei";
            var roundName = "UseCase1 - Create Table";
            var table = TableFactory.CreateTable(ModeratorName);
            table.AddDuration(1);
            table.AddDuration(2);
            table.AddDuration(3);
            table.AddRoundName(roundName);
            
            Assert.AreNotEqual(0,table.Id.Length);
            Assert.AreEqual(true,table.CanAddUser);
            Assert.AreEqual(ModeratorName,table.ModeratorName);
            Assert.AreEqual(1,table.Rounds.Length);
            Assert.AreEqual(roundName, table.Rounds[0].Name);


        }
    }