public void Execute_NullSourceModel_ThrowsException() { var mockSourceRepository = new Mock <ISourceRepository>(); var createSourceCommand = new CreateSourceCommand(mockSourceRepository.Object); Assert.Throws <ArgumentNullException>(() => createSourceCommand.Execute(null)); }
public void Execute_AddsSourceToDatabase() { var mockSourceRepository = new Mock <ISourceRepository>(); var createSourceCommand = new CreateSourceCommand(mockSourceRepository.Object); var sourceModel = new SourceModel(); createSourceCommand.Execute(sourceModel); mockSourceRepository.Verify(r => r.Add(It.IsAny <Source>()), Times.Once); }