Exemple #1
0
        public void CreateImageOnlyWithQueue()
        {
            var newGuid = Guid.NewGuid();

            var image = new Image
            {
                Created     = DateTime.Now,
                Description = "Test description",
                id          = newGuid,
                Name        = "Test name",
                // use our fluffy test image
                Bytes = File.ReadAllBytes("Images/dog-medium-landing-hero.jpg")
            };

            DocumentDbHelper.AddImageToDbAsync(
                image
                ).Wait();

            Console.WriteLine($"{newGuid} written to database!");

            ServiceBusHelper
            .AddMessageToQueueAsync($"{image.id}")
            .Wait();

            Console.WriteLine($"{newGuid} written to service bus!");
        }
Exemple #2
0
        public async Task UploadSingleFile()
        {
            var bytes = await Request
                        .Content
                        .ReadAsByteArrayAsync();

            var guid = Guid.NewGuid();

            await DocumentDbHelper.AddImageToDbAsync(new Core.Class.Image
            {
                id    = guid,
                Bytes = bytes
            });

            await ServiceBusHelper
            .AddMessageToQueueAsync(guid.ToString()
                                    );
        }
Exemple #3
0
 public void PutMessageOnServiceBus() => ServiceBusHelper
 .AddMessageToQueueAsync($"7d66b256-7324-4acf-8d6d-9c394da56686")
 .Wait();