public CreateExpenseReportResult(ExpenseReportModel expenseReport) : base(true, "Expense report created successfully")
 {
     this.ExpenseReport = expenseReport;
 }
Ejemplo n.º 2
0
        public void Controller_ExpenseReports_Post_IsSuccessful()
        {
            // Arrange
            int id = 1;
            CreateExpenseReportCommand command = new CreateExpenseReportCommand() { Title = "New Report" };
            ExpenseReportModel report = new ExpenseReportModel() { Id = id, Title = "New Report" };
            CreateExpenseReportResult result = new CreateExpenseReportResult(report);
            var mockQueryService = new Mock<IExpenseReportQueryService>();
            var mockEntryService = new Mock<IExpenseReportEntryService>();
            mockEntryService
                .Setup(x => x.CreateReport(command))
                .Returns(result);

            // Act
            ExpenseReportsController controller = new ExpenseReportsController(mockQueryService.Object, mockEntryService.Object);
            var postResult = controller.Post(command);

            // Assert
            Assert.AreEqual(id, postResult.ExpenseReport.Id);
        }