示例#1
0
        public async Task GetOrganisationByAppicationId_OnSuccess_ReturnsOrganisationAndOk()
        {
            var organisationId = Guid.NewGuid();
            var organisation   = new Organisation {
                Id = organisationId
            };

            _mediator.Setup(x => x.Send(It.IsAny <GetOrganisationByApplicationIdRequest>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(organisation);
            var result = await _controller.GetOrganisationByApplicationId(_applicationId);

            result.Should().BeOfType <ActionResult <Organisation> >();
            result.Result.Should().BeOfType <OkObjectResult>();
            var expectedOrganisation = ((ObjectResult)result.Result).Value as Organisation;

            expectedOrganisation.Id.Should().Be(organisationId);
        }