public void OnLoadBeheerThemasViewTest() { //Arrange var controller = new MockBeheerThemasController(); BeheerThemasPresenter presenter = new BeheerThemasPresenter(controller); MockBeheerThemasView view = new MockBeheerThemasView(); //Act presenter.View = view; presenter.OnViewLoaded(); //Assert Assert.AreEqual("thema-0",view.ThemaTable[0].ThemaNaam); }
public void OnThemaAddedCallsControlerAddThemaTest() { //Arrange var controller = new MockBeheerThemasController(); Thema thema = new Thema { ThemaNaam = "added" }; BeheerThemasPresenter presenter = new BeheerThemasPresenter(controller); MockBeheerThemasView view = new MockBeheerThemasView(); //Act presenter.OnThemasAdded(thema); //Asserts Assert.IsTrue(controller.AddThemaCalled); Assert.AreSame(thema, controller.MockThemas[0]); }
public void OnViewLoadedSetsTransfersIntheView() { //Arrange var controller = new MockBeheerThemasController(); Thema thema = new Thema{ThemaNaam="test1"}; controller.MockThemas.Add(thema); BeheerThemasPresenter presenter = new BeheerThemasPresenter(controller); MockBeheerThemasView view = new MockBeheerThemasView(); presenter.View = view; //Act presenter.OnViewLoaded(); //Assert Assert.AreEqual(1, view.ThemaTable.Count); Assert.AreSame(thema, view.ThemaTable[view.ThemaTable.Count-1]); }
public void GetThemaTable03() { MockBeheerThemasService mockBeheerThemasService; MockBeheerThemasController mockBeheerThemasController; IList<Thema> iList; Thema s0 = new Thema(); s0.Id = 0L; s0.ThemaNaam = (string)null; mockBeheerThemasService = MockBeheerThemasServiceFactory.Create(s0); mockBeheerThemasController = new MockBeheerThemasController(mockBeheerThemasService); mockBeheerThemasController.AddThemaCalled = false; mockBeheerThemasController.DeleteThemaCalled = false; mockBeheerThemasController.UpdateThemaCalled = false; mockBeheerThemasController.UpdatedThema = (Thema)null; mockBeheerThemasController.DeletedThema = (Thema)null; mockBeheerThemasController.AddThema((Thema)null); iList = this.GetThemaTable(mockBeheerThemasController); Assert.IsNotNull((object)iList); Assert.IsNotNull((object)mockBeheerThemasController); Assert.IsNotNull(mockBeheerThemasController.MockThemas); Assert.IsTrue( object.ReferenceEquals(mockBeheerThemasController.MockThemas, (object)iList) ); Assert.AreEqual<bool>(true, mockBeheerThemasController.AddThemaCalled); Assert.AreEqual<bool>(false, mockBeheerThemasController.DeleteThemaCalled); Assert.AreEqual<bool>(false, mockBeheerThemasController.UpdateThemaCalled); Assert.IsNull(mockBeheerThemasController.UpdatedThema); Assert.IsNull(mockBeheerThemasController.DeletedThema); Assert.IsNull(((BeheerThemasController)mockBeheerThemasController).ThemaTable); Assert.IsNull (((BeheerThemasController)mockBeheerThemasController).BeheerThemasService); Assert.AreEqual<bool> (true, ((BeheerThemasController)mockBeheerThemasController).AddThemaCalled); Assert.IsNull(((BeheerThemasController)mockBeheerThemasController).UpdatedThema); Assert.IsNull(((BeheerThemasController)mockBeheerThemasController).DeletedThema); Assert.AreEqual<bool>(false, ((BeheerThemasController)mockBeheerThemasController).DeleteThemaCalled); Assert.AreEqual<bool>(false, ((BeheerThemasController)mockBeheerThemasController).UpdateThemaCalled); }