public void GetBallsCountTest() { var stringWriter = new StringWriter(); var gumballMachine = new GumballMachineContext(2, stringWriter); Assert.AreEqual(( uint )2, gumballMachine.GetBallsCount()); }
public void SoldOutStateAtCreationWithZeroBalls() { var stringWriter = new StringWriter(); string result = $"(Mighty Gumball, Inc.C# - enabled Standing Gumball Model #2019 (with state)Inventory:" + $" { 0 } gumball{ ( 0 != 1 ? "s" : "" ) } Machine is { BaseConstants.TO_STRING_SOLD_OUT_STATE })"; var gumballMachine = new GumballMachineContext(0, stringWriter); Assert.AreEqual(result, gumballMachine.ToString()); Assert.AreEqual(( uint )0, gumballMachine.GetBallsCount()); }
public void NoQuarterStateAtCreationWithSomeBalls() { var stringWriter = new StringWriter(); string result = $"(Mighty Gumball, Inc.C# - enabled Standing Gumball Model #2019 (with state)Inventory:" + $" { 10 } gumball{ ( 10 != 1 ? "s" : "" ) } Machine is { BaseConstants.TO_STRING_NO_QUARTER_STATE })"; var gumballMachine = new GumballMachineContext(10, stringWriter); Assert.AreEqual(result, gumballMachine.ToString()); Assert.AreEqual(( uint )10, gumballMachine.GetBallsCount()); }