public void GenerateReport_FailsIfBothSourceAndTargetAreSelected() { var request = ReportingEventDtoSetup(); request.TargetUser = new ExternalId() { Context = "Raet", Id = "IC02" }; request.EndDate = DateTime.Now.AddDays(-2); var result = EnrichedEventController.Generate(request).Result; AreEqual(((ObjectResult)result).StatusCode, 400); AreEqual(((ObjectResult)result).Value, "Both Source and Target user cannot be selected"); }
public async void Given_SimpleUrl_When_NoSources_Then_ReturnsSimpleReport(string url) { // Arrange var generateReportResult = new GenerateReport.Result { Report = url, }; var generateReport = A.Fake <GenerateReport>(); var token = new CancellationToken(false); A.CallTo(() => generateReport.Execute(A <IReportService> .Ignored)) .Returns(Task.FromResult(generateReportResult)); var reportService = new ReportService(); var logger = A.Fake <ILogger <ReportController> >(); var sut = new ReportController(reportService, logger); // Act var result = await sut.Generate(url, token); // Assert var actionResult = Assert.IsType <ActionResult <GenerateReport.Result> >(result); //var returnValue = Assert.IsType<GenerateReport.Result>(actionResult.Value); Assert.NotNull(actionResult.Value?.Report); Assert.Equal(generateReportResult, actionResult.Value); A.CallTo(() => generateReport.Execute(A <IReportService> .Ignored)) .MustHaveHappenedOnceExactly(); }