public void Setup() { mediatorMock = new Mock <IMediator>(); controller = new ImplementationTimescalesController(mediatorMock.Object); simpleResultMock = new Mock <ISimpleResult>(); simpleResultMock.Setup(r => r.IsValid).Returns(() => !resultDictionary.Any()); simpleResultMock.Setup(r => r.ToDictionary()).Returns(() => resultDictionary); resultDictionary = new Dictionary <string, string>(); mediatorMock .Setup(m => m.Send(It.IsAny <UpdateImplementationTimescalesCommand>(), It.IsAny <CancellationToken>())) .ReturnsAsync(() => simpleResultMock.Object); }
public void Setup() { _mediatorMock = new Mock <IMediator>(); _controller = new ImplementationTimescalesController(_mediatorMock.Object); _simpleResultMock = new Mock <ISimpleResult>(); _simpleResultMock.Setup(x => x.IsValid).Returns(() => !_resultDictionary.Any()); _simpleResultMock.Setup(x => x.ToDictionary()).Returns(() => _resultDictionary); _resultDictionary = new Dictionary <string, string>(); _mediatorMock.Setup(x => x.Send(It.IsAny <UpdateImplementationTimescalesCommand>(), It.IsAny <CancellationToken>())) .ReturnsAsync(() => _simpleResultMock.Object); }