public void AddUserToBlob()
        {
            using (TransactionScope ts = new TransactionScope())
            {
                BlobShareDataStoreEntities context = BlobShareDataStoreEntities.CreateInstance();
                Blob blob = BlobServicesTests.CreateBlobForTest("Test Resource", context);
                User user = CreateUserForTest("testuser1", context);
                PermissionService service    = new PermissionService(context);
                Permission        permission = service.GrantPermissionToUserBlob(Privilege.Read, user, blob, DateTime.UtcNow.AddDays(1));

                Assert.IsNotNull(permission);
                Assert.AreEqual(user, permission.Users.First());
                Assert.AreEqual(blob, permission.Blob);
                Assert.AreEqual((int)Privilege.Read, permission.Privilege);

                IEnumerable <Blob> resources = service.GetBlobsByUser(user);

                Assert.IsNotNull(resources);
                Assert.AreEqual(1, resources.Count());
                Assert.AreEqual(blob.BlobId, resources.First().BlobId);

                Assert.IsTrue(service.CheckPermissionToBlob(user.NameIdentifier, user.IdentityProvider, blob.BlobId));

                BlobService blobService = new BlobService(context, CloudStorageAccount.DevelopmentStorageAccount, TestContainerName);
                CloudBlob   cloudBlob   = blobService.GetBlob(blob);
                cloudBlob.Delete();
            }
        }