Пример #1
0
        public async Task GetExistingVariablesShouldSucceed()
        {
            // Arrange
            var ticket = new Ticket()
            {
                Id = Guid.NewGuid()
                     .ToString(),
                OwnerIdentity    = "*****@*****.**",
                CustomerIdentity = "*****@*****.**"
            };

            HelpDeskExtension.GetCustomerActiveTicketAsync(UserIdentity, CancellationToken).Returns(ticket);
            var target = GetTarget();

            // Act
            var actualTicketId = await target.GetVariableAsync("id", Context, CancellationToken);

            var actualOwnerIdentity = await target.GetVariableAsync("ownerIdentity", Context, CancellationToken);

            var actualCustomerIdentity = await target.GetVariableAsync("customerIdentity", Context, CancellationToken);

            // Assert
            actualTicketId.ShouldBe(ticket.Id);
            actualOwnerIdentity.ShouldBe(ticket.OwnerIdentity);
            actualCustomerIdentity.ShouldBe(ticket.CustomerIdentity);
        }
Пример #2
0
        public async Task GetWithNoTicketShouldReturnNull()
        {
            // Arrange
            Ticket ticket = null;

            HelpDeskExtension.GetCustomerActiveTicketAsync(UserIdentity, CancellationToken)
            .Throws(new LimeException(ReasonCodes.COMMAND_RESOURCE_NOT_FOUND, "Not found"));
            var target = GetTarget();

            // Act
            var actual = await target.GetVariableAsync("id", Context, CancellationToken);

            // Assert
            actual.ShouldBeNull();
        }
Пример #3
0
        public async Task GetNullPropertyShouldReturnNull()
        {
            // Arrange
            var ticket = new Ticket()
            {
                Id = null
            };

            HelpDeskExtension.GetCustomerActiveTicketAsync(UserIdentity, CancellationToken).Returns(ticket);
            var target = GetTarget();

            // Act
            var actual = await target.GetVariableAsync("id", Context, CancellationToken);

            // Assert
            actual.ShouldBeNull();
        }
Пример #4
0
        public async Task GetNonExistingPropertyShouldReturnNull()
        {
            // Arrange
            var ticket = new Ticket()
            {
                Id = Guid.NewGuid()
                     .ToString(),
                OwnerIdentity    = "*****@*****.**",
                CustomerIdentity = "*****@*****.**"
            };

            HelpDeskExtension.GetCustomerActiveTicketAsync(UserIdentity, CancellationToken).Returns(ticket);
            var target = GetTarget();

            // Act
            var actual = await target.GetVariableAsync("doesNotExists", Context, CancellationToken);

            // Assert
            actual.ShouldBeNull();
        }