Freigeben über


Coding Dojo 4

Fourth MSFTCorpDojo today. MineSweeper and MicroPairing this time too.This time we, as a result of the retrospect from last time, we did BDD-style testing (I've added one of the test classes below as an example). We decided to start by implementing a parser that parsed the input and created an internal representation of the input that we could later use to generate the output. By the end of the session we had a pretty complete parser with error handling for all kinds of bad input. This is one of the few times I've seen any real error handling in a dojo.

This time in the retrospect we said that the next time we should implement the other part next time. That is; assume a parsed input in some internal representation and generate the output from that. We also talked about how we do MicroPairing and switch one person in the pair every seven minutes. We decided to next time switch one person in the pair every time the keyboard gets passed instead. Guess that will mean less pair programming since there is no real ping-pong but rather a circular queue. But in our session almost everybody participates all the time anyway so that might not necessarily be a problem.

 
   1:      public class Given_a_single_1x1_fieldset_with_no_bombs
   2:      {
   3:          private string input;
   4:          private Field field;
   5:   
   6:          public Given_a_single_1x1_fieldset_with_no_bombs()
   7:          {
   8:              input = "1 1" + Environment.NewLine +
   9:                      "." + Environment.NewLine +
  10:                      "0 0";
  11:              field = FieldParser.Parse(input).Single();
  12:          }
  13:   
  14:          [Fact]
  15:          public void It_should_have_one_row()
  16:          {
  17:              Assert.Equal(1, field.Rows);
  18:          }
  19:   
  20:          [Fact]
  21:          public void It_should_have_one_column()
  22:          {
  23:              Assert.Equal(1, field.Columns);
  24:          }
  25:   
  26:          [Fact]
  27:          public void It_should_have_an_empty_square_0_0()
  28:          {
  29:              Assert.False(field.IsBomb(0, 0));
  30:          }
  31:      }