Example #1
0
        public void RemoveSet()
        {
            using (TransactionScope ts = new TransactionScope())
            {
                BlobShareDataStoreEntities context = BlobShareDataStoreEntities.CreateInstance();
                BlobSet set  = CreateBlobSetForTest("Test List", context);
                Blob    blob = BlobServicesTests.CreateBlobForTest("Test Resource", context);

                BlobSetService service = new BlobSetService(context);
                service.AddBlobToSet(set.BlobSetId, blob.BlobId);
                BlobSet newList = service.GetBlobSetById(set.BlobSetId);

                Assert.IsNotNull(newList);
                Assert.AreEqual(1, newList.Blobs.Count);

                service.DeleteBlobSet(set.BlobSetId);

                BlobSet deletedList = service.GetBlobSetById(set.BlobSetId);

                Assert.IsNull(deletedList);

                BlobService bservices   = new BlobService(context, CloudStorageAccount.DevelopmentStorageAccount, TestContainerName);
                Blob        newResource = bservices.GetBlobById(blob.BlobId);

                Assert.IsNotNull(newResource);
                Assert.AreEqual(0, newResource.BlobSets.Count);
            }
        }
Example #2
0
        public void UpdateExistingList()
        {
            using (TransactionScope ts = new TransactionScope())
            {
                BlobShareDataStoreEntities context = BlobShareDataStoreEntities.CreateInstance();
                BlobSet set  = CreateBlobSetForTest("Test List", context);
                Blob    blob = BlobServicesTests.CreateBlobForTest("Test Resource", context);

                BlobSetService service = new BlobSetService(context);
                service.AddBlobToSet(set.Name, blob.BlobId);

                set.Name        = "updated test list";
                set.Description = "updated test description";
                service.UpdateBlobSet(set);

                BlobSet newSet = service.GetBlobSetById(set.BlobSetId);

                Assert.IsNotNull(newSet);
                Assert.AreEqual(1, newSet.Blobs.Count);
                Assert.AreEqual(set.Name, newSet.Name);
                Assert.AreEqual(set.Description, newSet.Description);
            }
        }