public void ConsumablesWork() { var stub = new PositionListDataHolderStub(); IPositionList positionList = new PositionListFeedback(stub); var consumables = positionList.Consumables; Assert.AreEqual(new Consumable(1, "water", 0), consumables[0]); }
public void LoadPositionList_Method_Invokes_PositionListLoaded_Event() { IPositionList positionList = new PositionListFeedback(new PositionListDataHolderStub()); bool invoked = false; EventHandler <PositionListChangedEventArgs> handler = (sender, e) => invoked = true; positionList.PositionListChanged += handler; positionList.LoadPositionList(); Assert.IsTrue(invoked); }
public void UpdatePositionInvokesDataHolderUpdatePositionMethod() { var stub = new PositionListDataHolderStub(); IPositionList positionList = new PositionListFeedback(stub); bool invoked = false; EventHandler <PositionListChangedEventArgs> handler = (sender, e) => invoked = true; stub.PositionListChanged += handler; positionList.UpdatePosition(new DTO.Position(1, "1", "1")); Assert.IsTrue(invoked); }
public void AddPosition_Method_Invokes_PositionAdded_Event() { var stub = new PositionListDataHolderStub(); IPositionList positionList = new PositionListFeedback(stub); bool invoked = false; EventHandler <PositionListChangedEventArgs> handler = (sender, e) => invoked = true; positionList.PositionListChanged += handler; positionList.AddPosition(new DTO.Position(1, "1", "1")); Assert.IsTrue(invoked); }
public void PositionListLoadedEvent_Returns_PositionListFromRepository() { IPositionList positionList = new PositionListFeedback(new PositionListDataHolderStub()); List <DTO.Position> positions = null; EventHandler <PositionListChangedEventArgs> handler = (sender, e) => positions = e.Positions; positionList.PositionListChanged += handler; positionList.LoadPositionList(); List <DTO.Position> expectedPositions = new List <DTO.Position>() { new DTO.Position(1, "1", "1"), new DTO.Position(2, "2", "2") }; Assert.AreEqual(expectedPositions[0], positions[0]); Assert.AreEqual(expectedPositions[1], positions[1]); Assert.AreEqual(expectedPositions.Count, positions.Count); }