public async Task GivenServiceQueue_WhenGetAndExist_ReturnData() { // Verify queue does not exist, if so delete it. bool exist = await _queueManagement.QueueExists(_workContext, _queueDefinition.QueueName !); if (exist) { await _queueManagement.DeleteQueue(_workContext, _queueDefinition.QueueName !); } // Create queue QueueDefinition subject = await _queueManagement.CreateQueue(_workContext, _queueDefinition); subject.Should().NotBeNull(); (_queueDefinition == subject).Should().BeTrue(); subject = await _queueManagement.GetQueue(_workContext, _queueDefinition.QueueName !); subject.Should().NotBeNull(); (_queueDefinition == subject).Should().BeTrue(); }
public async Task GivenServiceExistQueue_WhenSearchedWildcard_ShouldFind() { // Verify queue does not exist, if so delete it. bool exist = await _queueManagement.QueueExists(_workContext, _queueDefinition.QueueName !); if (!exist) { QueueDefinition createSubject = await _queueManagement.CreateQueue(_workContext, _queueDefinition); createSubject.Should().NotBeNull(); (_queueDefinition == createSubject).Should().BeTrue(); } IReadOnlyList <QueueDefinition> subjects = await _queueManagement.Search(_workContext, "unit1*"); subjects.Should().NotBeNull(); subjects.Count.Should().Be(1); subjects[0].QueueName.Should().BeEquivalentTo(_queueDefinition.QueueName); await _queueManagement.DeleteQueue(_workContext, _queueDefinition.QueueName !); }
public async Task GivenServiceQueue_WhenCreatedTwice_ShouldThrow() { // Verify queue does not exist, if so delete it. bool exist = await _queueManagement.QueueExists(_workContext, _queueDefinition.QueueName !); if (exist) { await _queueManagement.DeleteQueue(_workContext, _queueDefinition.QueueName !); } // Create queue QueueDefinition subject = await _queueManagement.CreateQueue(_workContext, _queueDefinition); subject.Should().NotBeNull(); (_queueDefinition == subject).Should().BeTrue(); Func <Task> act = async() => await _queueManagement.CreateQueue(_workContext, _queueDefinition); await act.Should().ThrowAsync <MessagingEntityAlreadyExistsException>(); await _queueManagement.DeleteQueue(_workContext, _queueDefinition.QueueName !); }