예제 #1
0
        public async Task GetCategoryReturnsNullWhenCategoryNotFoundTest()
        {
            var category = Model.Create <Category>();

            var sut = new CategoryStore(Config.Storage);

            var actual = await sut.GetCategory(category.Group, category.Name, CancellationToken.None)
                         .ConfigureAwait(false);

            actual.Should().BeNull();
        }
예제 #2
0
        public async Task GetCategoryReturnsStoredCategoryTest()
        {
            var category = Model.Create <Category>();

            var sut = new CategoryStore(Config.Storage);

            await sut.StoreCategory(category, CancellationToken.None).ConfigureAwait(false);

            var actual = await sut.GetCategory(category.Group, category.Name, CancellationToken.None)
                         .ConfigureAwait(false);

            actual.Should().BeEquivalentTo(category);
        }
예제 #3
0
        public async Task GetCategoryReturnsNullWhenTableNotFoundTest()
        {
            // Retrieve storage account from connection-string
            var storageAccount = CloudStorageAccount.Parse(Config.Storage.ConnectionString);

            // Create the table client
            var client = storageAccount.CreateCloudTableClient();

            var table = client.GetTableReference("Categories");

            await table.DeleteIfExistsAsync().ConfigureAwait(false);

            var category = Model.Create <Category>();

            var sut = new CategoryStore(Config.Storage);

            var actual = await sut.GetCategory(category.Group, category.Name, CancellationToken.None)
                         .ConfigureAwait(false);

            actual.Should().BeNull();
        }