public void PassLastNameProperly_ToFactory_WhenArgument_IsValid(string randomString) { var mockedArgs = new MockedWorkerDetailsEventArgs(); mockedArgs.LastName = randomString; var mockedView = new Mock <IAPWorkerDetailsControlView>(); var mockedService = new Mock <IWorkersAsyncService>(); var mockedDtoFactory = new Mock <IWorkerDetailInformationDTOFactory>(); mockedDtoFactory.Setup(x => x.GetWorkerDetailInformationDTO(It.IsAny <int>(), It.IsAny <string>(), randomString, It.IsAny <GenderType>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())).Verifiable(); var obj = new APWorkerDetailsPresenter(mockedView.Object, mockedService.Object, mockedDtoFactory.Object); mockedView.Raise(x => x.EditRequest += null, mockedArgs); mockedDtoFactory.Verify(); }
public void CallServiceRightMethod_WithSameWorkerDto_CameFromFactory_WhenArguments_AreValid() { var mockedWorkerDto = new Mock <WorkerDetailInformationDTO>(); var mockedArgs = new MockedWorkerDetailsEventArgs(); var mockedView = new Mock <IAPWorkerDetailsControlView>(); var mockedService = new Mock <IWorkersAsyncService>(); mockedService.Setup(x => x.UpdateWorkerDetailInformationDTO(mockedWorkerDto.Object)).Verifiable(); var mockedDtoFactory = new Mock <IWorkerDetailInformationDTOFactory>(); mockedDtoFactory.Setup(x => x.GetWorkerDetailInformationDTO(It.IsAny <int>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <GenderType>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())).Returns(mockedWorkerDto.Object); var obj = new APWorkerDetailsPresenter(mockedView.Object, mockedService.Object, mockedDtoFactory.Object); mockedView.Raise(x => x.EditRequest += null, mockedArgs); mockedService.Verify(); }