Esempio n. 1
0
 public void ShouldBeAbleToDrawSingleBean()
 {
     var drawPile = new DrawPile(new DiscardPile());
     var bean1 = new Bean(1, Suit.Blue);
     var bean2 = new Bean(2, Suit.Green);
     drawPile.AddBeans(new[] {bean1, bean2});
     Assert.AreEqual(new[] {bean1}, drawPile.Draw(1));
 }
Esempio n. 2
0
 public void ShouldRejectBeanOfSameSuit()
 {
     var cargo = new BeanCargo();
     var existingBeans = new[] { new Bean(1, Suit.Blue), new Bean(2, Suit.Blue), };
     cargo.AddBeans(existingBeans);
     var beanToAdd = new Bean(3, Suit.Green);
     Assert.IsFalse(cargo.CanAddBean(beanToAdd));
 }
Esempio n. 3
0
 public void ShouldAllowBeanOfSameSuit()
 {
     var cargo = new BeanCargo();
     var existingBeans = new[] { new Bean(1, Suit.Blue), };
     cargo.AddBeans(existingBeans);
     var beanToAdd = new Bean(3, Suit.Blue);
     Assert.IsTrue(cargo.CanAddBean(beanToAdd));
 }
Esempio n. 4
0
 public void ShouldBeAbleToDrawMultipleBeans()
 {
     var drawPile = new DrawPile(new DiscardPile());
     var bean1 = new Bean(1, Suit.Blue);
     var bean2 = new Bean(2, Suit.Green);
     var bean3 = new Bean(3, Suit.Red);
     drawPile.AddBeans(new[] { bean1, bean2, bean3 });
     Assert.AreEqual(new [] {bean1, bean2}, drawPile.Draw(2));
 }
Esempio n. 5
0
 public void ShouldReshuffleIfDrawingMoreCardsThanAvailable()
 {
     var discardPile = new DiscardPile();
     var drawPile = new DrawPile(discardPile);
     var bean1 = new Bean(1, Suit.Blue);
     drawPile.AddBeans(new[] { bean1 });
     var bean2 = new Bean(4, Suit.Orange);
     var bean3 = new Bean(5, Suit.Purple);
     discardPile.DiscardBeans(new[] { bean2, bean3, });
     Assert.AreEqual(new[] { bean1, bean2 }, drawPile.Draw(2));
     Assert.AreEqual(0, discardPile.Count);
 }
Esempio n. 6
0
 public void ShouldNotReshuffleIfDrawingFewerCardsThanAvailable()
 {
     var discardPile = new DiscardPile();
     var drawPile = new DrawPile(discardPile);
     var bean1 = new Bean(1, Suit.Blue);
     var bean2 = new Bean(2, Suit.Green);
     var bean3 = new Bean(3, Suit.Red);
     drawPile.AddBeans(new[] { bean1, bean2, bean3 });
     discardPile.DiscardBeans(new[] { new Bean(4, Suit.Orange), new Bean(5, Suit.Purple), });
     Assert.AreEqual(new[] { bean1, bean2 }, drawPile.Draw(2));
     Assert.AreEqual(2, discardPile.Count);
 }
Esempio n. 7
0
 public string FormatBeanLong(Bean bean)
 {
     return bean.Rank + " of " + bean.Suit;
 }
Esempio n. 8
0
 public string FormatBeanShort(Bean bean)
 {
     return bean.Rank.ToString() + bean.Suit.ToString()[0];
 }
Esempio n. 9
0
 public void ShouldAllowBeanWhenEmpty()
 {
     var cargo = new BeanCargo();
     var beanToAdd = new Bean(3, Suit.Blue);
     Assert.IsTrue(cargo.CanAddBean(beanToAdd));
 }
Esempio n. 10
0
 public void ShouldFormatBeanShort()
 {
     var beanToFormat = new Bean(8, Suit.Orange);
     var formattedBean = formatter.FormatBeanShort(beanToFormat);
     Assert.AreEqual("8O", formattedBean);
 }