Exemplo n.º 1
0
        public void Call_Base_With_Same_View()
        {
            var mockedView = new Mock <IAPWorkersControlView>();

            var mockedService = new Mock <IWorkersAsyncService>();

            var obj = new APWorkersControlPresenter(mockedView.Object, mockedService.Object);

            Assert.AreSame(mockedView.Object, obj.View);
        }
Exemplo n.º 2
0
        public void Set_WorkerService_In_ServiceField()
        {
            var mockedView = new Mock <IAPWorkersControlView>();

            var mockedService = new Mock <IWorkersAsyncService>();

            var obj = new APWorkersControlPresenter(mockedView.Object, mockedService.Object);

            BindingFlags flags        = BindingFlags.NonPublic | BindingFlags.Instance;
            var          serviceField = typeof(APWorkersControlPresenter).GetField("workersService", flags);
            var          result       = serviceField.GetValue(obj);

            Assert.AreSame(mockedService.Object, result);
        }
        public void Set_DataToViewModel_WhenViewFireTheEvent()
        {
            var mockedCollection = new Mock <IEnumerable <WorkerNamesIdDTO> >();

            var mockedModel = new Mock <APWorkersControlViewModel>();

            var mockedView = new Mock <IAPWorkersControlView>();

            mockedView.Setup(x => x.Model).Returns(mockedModel.Object);

            var mockedService = new Mock <IWorkersAsyncService>();

            mockedService.Setup(x => x.GetWorkersNamesAndId()).Returns(mockedCollection.Object);

            var obj = new APWorkersControlPresenter(mockedView.Object, mockedService.Object);

            mockedView.Raise(x => x.GetWorkersNamesAndId += null, EventArgs.Empty);

            Assert.AreSame(mockedCollection.Object, mockedModel.Object.WorkersNamesAndId);
        }