Пример #1
0
        public void ApplicationCount()
        {
            var userId        = Guid.NewGuid();
            var table         = new AzureTable <ApplicationInfoData>(CloudStorageAccount.DevelopmentStorageAccount);
            var random        = new Random();
            var expectedCount = random.Next(15);

            for (int i = 0; i < expectedCount; i++)
            {
                var ua = new ApplicationInfoData(Guid.NewGuid())
                {
                    Owner = userId,
                };

                table.AddOrUpdateEntity(ua);
            }

            var user = new User()
            {
                Identifier = userId,
            };

            var appCore = new ApplicationCore();
            var count   = appCore.ApplicationCount(user);

            Assert.AreEqual <int>(expectedCount, count);
        }
Пример #2
0
        public void ApplicationCountEmptyUserId()
        {
            var u = new User()
            {
                Identifier = Guid.Empty,
            };
            var core = new ApplicationCore();

            core.ApplicationCount(u);
        }
Пример #3
0
        public void ApplicationCountZero()
        {
            var user = new User()
            {
                Identifier = Guid.NewGuid(),
            };

            var appCore = new ApplicationCore();
            var count   = appCore.ApplicationCount(user);

            Assert.AreEqual <int>(0, count);
        }
 public ActionResult ApplicationCount()
 {
     using (new PerformanceMonitor())
     {
         try
         {
             var user = User.Identity.Data();
             if (User.Identity.IsManager())
             {
                 return(this.Json(100, JsonRequestBehavior.AllowGet));
             }
             else
             {
                 return(this.Json(appCore.ApplicationCount(user), JsonRequestBehavior.AllowGet));
             }
         }
         catch (Exception ex)
         {
             logger.Log(ex, EventTypes.Error, (int)Fault.Unknown);
             return(this.Json(WebResponse.Bind((int)Fault.Unknown, ex.Message), JsonRequestBehavior.AllowGet));
         }
     }
 }
Пример #5
0
        public void ApplicationCountNullUser()
        {
            var core = new ApplicationCore();

            core.ApplicationCount(null);
        }