public void SetViewModelSucceededToTrue_WhenEventIsRaised() { //Arrange var viewMock = new Mock <IUserUploadImageView>(); viewMock.Setup(v => v.Model).Returns(new UploadImageViewModel()); var uploadedImageServiceMock = new Mock <IUploadedImageService>(); var userServiceMock = new Mock <IUserService>(); string anyString = It.IsAny <string>(); var presenter = new UserUploadImagePresenter(viewMock.Object, uploadedImageServiceMock.Object, userServiceMock.Object); //Act viewMock.Raise(v => v.UploadImageWithUrl += null, new UserUploadImageEventArgs()); //Assert Assert.IsTrue(viewMock.Object.Model.Succeeded); }
public void CallUploadedImageServiceUploadImage_WhenEventIsRaised() { //Arrange var viewMock = new Mock <IUserUploadImageView>(); viewMock.Setup(v => v.Model).Returns(new UploadImageViewModel()); var uploadedImageServiceMock = new Mock <IUploadedImageService>(); var userServiceMock = new Mock <IUserService>(); string anyString = It.IsAny <string>(); var presenter = new UserUploadImagePresenter(viewMock.Object, uploadedImageServiceMock.Object, userServiceMock.Object); //Act viewMock.Raise(v => v.UploadImageWithUrl += null, new UserUploadImageEventArgs()); //Assert uploadedImageServiceMock.Verify(s => s.UploadImage(anyString, anyString, anyString, null), Times.Once); }