<commit_before>﻿
namespace ServiceBus.AttachmentPlugin.Tests
{
    using System;
    using System.Text;
    using System.Threading.Tasks;
    using Microsoft.Azure.ServiceBus;
    using Xunit;

    public class When_receiving_message : IClassFixture<AzureStorageEmulatorFixture>
    {

        [Fact]
        public async Task Should_throw_exception_with_blob_path_for_found_that_cant_be_found()
        {
            var payload = "payload";
            var bytes = Encoding.UTF8.GetBytes(payload);
            var message = new Message(bytes)
            {
                MessageId = Guid.NewGuid().ToString(),
            };

            var sendingPlugin = new AzureStorageAttachment(new AzureStorageAttachmentConfiguration(
                connectionString: "UseDevelopmentStorage=true", containerName: "attachments"));
            await sendingPlugin.BeforeMessageSend(message);

            var receivingPlugin = new AzureStorageAttachment(new AzureStorageAttachmentConfiguration(
                connectionString: "UseDevelopmentStorage=true", containerName: "attachments-wrong-containers"));

            var exception = await Assert.ThrowsAsync<Exception>(() => receivingPlugin.AfterMessageReceive(message));
            Assert.Contains("attachments-wrong-containers", exception.Message);
            Assert.Contains(message.UserProperties["$attachment.blob"].ToString(), exception.Message);
        }
    }
}<commit_msg>Fix failing R# code analysis<commit_after>﻿
namespace ServiceBus.AttachmentPlugin.Tests
{
    using System;
    using System.Text;
    using System.Threading.Tasks;
    using Microsoft.Azure.ServiceBus;
    using Xunit;

    public class When_receiving_message : IClassFixture<AzureStorageEmulatorFixture>
    {

        [Fact]
        public async Task Should_throw_exception_with_blob_path_for_found_that_cant_be_found()
        {
            var payload = "payload";
            var bytes = Encoding.UTF8.GetBytes(payload);
            var message = new Message(bytes)
            {
                MessageId = Guid.NewGuid().ToString(),
            };

            var sendingPlugin = new AzureStorageAttachment(new AzureStorageAttachmentConfiguration(
                connectionString: "UseDevelopmentStorage=true", containerName: "attachments"));
            await sendingPlugin.BeforeMessageSend(message);

            var receivingPlugin = new AzureStorageAttachment(new AzureStorageAttachmentConfiguration(
                connectionString: "UseDevelopmentStorage=true", containerName: "attachments-wrong-containers"));

            var exception = await Assert.ThrowsAsync<Exception>(() => receivingPlugin.AfterMessageReceive(message));
            Assert.Contains("attachments-wrong-containers", actualString: exception.Message);
            Assert.Contains(message.UserProperties["$attachment.blob"].ToString(), actualString: exception.Message);
        }
    }
}
{'fraction_non_alphanumeric': 0.08840729274165807, 'fraction_numerical': 0.0006879944960440316, 'mean_word_length': 3.0785413744740535, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3314844', 'n_tokens_mistral': 720, 'n_tokens_neox': 694, 'n_words': 132}