public void Execute_RecordDoesNotExist_ThrowsException() { int id = new Random().Next(1, 1000); ProjectRequestAggregateModel model = null; _projectRequestAggregateRepo.GetById(id).Returns(model); // execute TestDelegate del = () => _deleteProjectRequestAggregateCommand.Execute(id); // assert Assert.Throws <InvalidOperationException>(del); // we shouldn't have even tried to do the delete _dbContext.DidNotReceive().ExecuteNonQuery(Arg.Any <string>(), Arg.Any <object>()); }
public dynamic DeleteAggregate() { int id = this.Request.Form["id"]; _dbContext.BeginTransaction(); _deleteProjectRequestAggregateCommand.Execute(id); _dbContext.Commit(); return(HttpStatusCode.OK); }