public void CountReturnsCorrectNumberOfObjects() { IGlobalState state = new GlobalState(); state.Add("test", 8); state.Add("test2", "Steve"); Assert.AreEqual(2, state.Count()); }
public void GetReturnsObjectFromGlobalStateForDifferentTypes() { IGlobalState state = new GlobalState(); state.Add("test", 8); state.Add("test2", "Steve"); Assert.AreEqual(8, (int)state.Get("test")); Assert.AreEqual("Steve", (string)state.Get("test2")); }
public void ClearEmptiesInventory() { IGlobalState state = new GlobalState(); state.Add("test", 8); state.Add("test2", "Steve"); Assert.AreEqual(2, state.Count()); state.Clear(); Assert.AreEqual(0, state.Count()); }
public void ExistsReturnsTrueForObjectThatExists() { IGlobalState state = new GlobalState(); int testNumber = 8; state.Add("test", testNumber); Assert.AreEqual(true, state.Exists("test")); }
public void GetReturnsObjectFromGlobalState() { IGlobalState state = new GlobalState(); int testNumber = 8; state.Add("test", testNumber); Assert.AreEqual(testNumber, (int)state.Get("test")); Assert.AreEqual(8, (int)state.Get("test")); }
public void AddInsertsObjectInGameState() { IGlobalState state = new GlobalState(); int testNumber = 8; state.Add("test", testNumber); Assert.AreEqual(1, state.Count()); Assert.AreEqual(testNumber, (int)state.Get("test")); }
public void UpdateValueInStateObjectWithMixedCase() { IGlobalState state = new GlobalState(); state.Add("counter", 0); Assert.AreEqual(0, (int)state.Get("Counter")); var counter = (int)state.Get("CoUnTer"); counter++; state.Update("counTeR", counter); Assert.AreEqual(1, (int)state.Get("cOuNtEr")); }
public void UpdateValueInStateObject() { IGlobalState state = new GlobalState(); state.Add("counter", 0); Assert.AreEqual(0, (int)state.Get("counter")); var counter = (int)state.Get("counter"); counter++; state.Update("counter", counter); Assert.AreEqual(1, (int)state.Get("counter")); }
public void AddThrowsArgumentNullExceptionIfObjectIsNull() { IGlobalState state = new GlobalState(); state.Add("pizza", null); }
public void AddThrowsArgumentNullExceptionIfNameIsNullOrEmpty() { IGlobalState state = new GlobalState(); state.Add("", null); }