예제 #1
0
 public void CreateEventUserViewBlobSet()
 {
     using (TransactionScope ts = new TransactionScope())
     {
         BlobShareDataStoreEntities context = BlobShareDataStoreEntities.CreateInstance();
         EventService service = new EventService(context);
         User user = this.GetTestUser(context);
         BlobSet set = this.GetTestBlobSet(context);
         service.CreateEventUserViewBlobSet(user.NameIdentifier, user.IdentityProvider, set);
         Assert.AreEqual(1, user.BlobSetEvents.Count);
         Assert.AreEqual((int)EventType.View, user.BlobSetEvents.First().EventType);
     }
 }
예제 #2
0
        public void GetBlobSetEvents()
        {
            using (TransactionScope ts = new TransactionScope())
            {
                var context = BlobShareDataStoreEntities.CreateInstance();
                var eventService = new EventService(context);
                var user = this.GetTestUser(context);
                var blobSet = this.GetTestBlobSet(context);

                eventService.CreateEventUserViewBlobSet(user.NameIdentifier, user.IdentityProvider, blobSet);

                var reportService = new ReportService(context);
                int totalPages;

                var events = reportService.GetBlobSetEvents(
                    DateTime.UtcNow.AddSeconds(-5),
                    DateTime.UtcNow.AddSeconds(1),
                    EventType.View,
                    100,
                    1,
                    out totalPages);

                Assert.AreEqual(1, totalPages);
                Assert.AreEqual(1, events.Count());
                var e = events.First();
                Assert.AreEqual(blobSet.BlobSetId, e.BlobSet.BlobSetId);
                Assert.AreEqual(blobSet.Name, e.BlobSet.Name);
                Assert.AreEqual((int)EventType.View, e.EventType);
                Assert.AreEqual(user.UserId, e.User.UserId);
            }
        }