コード例 #1
0
        public async Task <ObjectResult> GetTicketPriorities(TicketOptionType type, CancellationToken cancellationToken)
        {
            var scope = _mediatorFactory.CreateScope();

            return(type switch
            {
                TicketOptionType.TicketPriority => new ObjectResult(
                    await scope.SendAsync(GetTicketPrioritiesMediatorQuery.CreateQuery(), cancellationToken)),
                TicketOptionType.TicketState => new ObjectResult(
                    await scope.SendAsync(GetTicketStatesMediatorQuery.CreateQuery(), cancellationToken)),
                TicketOptionType.TicketType => new ObjectResult(
                    await scope.SendAsync(GetTicketTypesMediatorQuery.CreateQuery(), cancellationToken)),
                _ => new BadRequestObjectResult("Please use a valid ticket option.")
            });
コード例 #2
0
        public async Task GetTicketTypes_Success()
        {
            // Arrange


            // Act
            var result = await _sut.Handle(GetTicketTypesMediatorQuery.CreateQuery(), default);

            // Assert
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Types.Contains(TicketType.Bug.ToString()));
            Assert.IsTrue(result.Types.Contains(TicketType.Defect.ToString()));
            Assert.IsTrue(result.Types.Contains(TicketType.ProductBacklogItem.ToString()));
        }