Пример #1
0
        public void ReturnsCanvasUserIsAddedAsGroup()
        {
            var canvas = Presto.Persist <Canvas>();

            ClarityDB.CurrentTenant = canvas.Tenant;
            ClarityDB.CurrentTenant.Canvases.Add(canvas);
            var group = CreateGroup(canvas.Tenant);

            canvas.MenuTile.Members.Add(new Membership {
                Group = group, GroupID = group.ID
            });

            var user = CreateUser(canvas.Tenant);

            group.Users.Add(user);

            try
            {
                ClarityDB.Instance.SaveChanges();
            }
            catch (System.Data.Entity.Validation.DbEntityValidationException ex)
            {
                throw ex;
            }

            ClarityDB.CreateInstance(user);
            Assert.AreEqual(1, ClarityDB.Instance.Canvases.Count());
        }
 public virtual void SetUp()
 {
     ClarityDB.CreateInstance();
     ClarityDB.Instance.Database.Initialize(false);
     DatabaseHelper.ConfigureClarityDB();
     DatabaseHelper.TruncateTables();
 }
Пример #3
0
        public void ReturnsOwnMenu()
        {
            var menuTile = Presto.Persist <MenuTile>();

            ClarityDB.Instance.SaveChanges();

            ClarityDB.CreateInstance(menuTile.Owner);
            Assert.AreEqual(1, ClarityDB.Instance.MenuTiles.Count());
        }
        public void ReturnsOwnScorecard()
        {
            var scorecard = Presto.Persist <Scorecard>();

            ClarityDB.Instance.SaveChanges();

            ClarityDB.CreateInstance(scorecard.MenuTile.Owner);
            Assert.AreEqual(1, ClarityDB.Instance.Scorecards.Count());
        }
        public void FiltersOtherPersonScorecardSection()
        {
            var section = Presto.Persist <ScorecardSection>();
            var user    = CreateUser(section.Scorecard.Tenant);

            ClarityDB.Instance.SaveChanges();

            ClarityDB.CreateInstance(user);
            Assert.AreEqual(0, ClarityDB.Instance.ScorecardSections.Count());
        }
Пример #6
0
        public void FiltersOtherPersonMenuTile()
        {
            var menuTile = Presto.Persist <MenuTile>();
            var user     = CreateUser(menuTile.Tenant);

            ClarityDB.Instance.SaveChanges();

            ClarityDB.CreateInstance(user);
            Assert.AreEqual(0, ClarityDB.Instance.MenuTiles.Count());
        }
Пример #7
0
        public void FiltersOtherPersonCanvas()
        {
            var canvas = Presto.Persist <Canvas>();
            var user   = CreateUser(canvas.Tenant);

            ClarityDB.CurrentTenant = canvas.Tenant;
            ClarityDB.Instance.SaveChanges();

            ClarityDB.CreateInstance(user);
            Assert.AreEqual(0, ClarityDB.Instance.Canvases.Count());
        }
Пример #8
0
        public void ReturnsOwnCanvas()
        {
            var canvas = Presto.Persist <Canvas>();

            ClarityDB.CurrentTenant = canvas.Tenant;
            ClarityDB.CurrentTenant.Canvases.Add(canvas);
            ClarityDB.Instance.SaveChanges();

            ClarityDB.CreateInstance(canvas.MenuTile.Owner);
            Assert.AreEqual(1, ClarityDB.Instance.Canvases.Count());
        }
        public void FiltersOtherPersonCanvasPage()
        {
            var page = Presto.Persist <Page>();
            var user = CreateUser(page.Canvas.Tenant);

            ClarityDB.CurrentTenant = page.Canvas.Tenant;
            ClarityDB.CurrentTenant.Canvases.Add(page.Canvas);
            ClarityDB.Instance.SaveChanges();

            ClarityDB.CreateInstance(user);
            Assert.AreEqual(0, ClarityDB.Instance.Pages.Count());
        }
        public override void SetUp()
        {
            base.SetUp();

            var user = Presto.Persist <User>();

            firstTenant  = user.Tenant;
            secondTenant = Presto.Persist <Tenant>();
            ClarityDB.Instance.SaveChanges();

            ClarityDB.CreateInstance(user);
        }
Пример #11
0
        public override void SetUp()
        {
            base.SetUp();

            firstFigure = Presto.Persist <Figure>();
            firstTenant = firstFigure.Page.Canvas.Tenant;

            secondFigure = Presto.Persist <Figure>();
            secondTenant = secondFigure.Page.Canvas.Tenant;

            ClarityDB.Instance.SaveChanges();
            ClarityDB.CreateInstance(firstTenant.Users.First());
        }
        public void ReturnsOwnCanvasFigures()
        {
            var figure = Presto.Persist <Figure>();

            ClarityDB.CurrentTenant = figure.Page.Canvas.Tenant;
            ClarityDB.CurrentTenant.Canvases.Add(figure.Page.Canvas);
            ClarityDB.Instance.SaveChanges();

            ClarityDB.CreateInstance(figure.Page.Canvas.MenuTile.Owner);

            ClarityDB.Instance.SaveChanges();
            Assert.AreEqual(1, ClarityDB.Instance.Figures.Count());
        }
Пример #13
0
        public override void SetUp()
        {
            base.SetUp();

            firstScorecardSection = Presto.Persist <ScorecardSection>();
            firstTenant           = firstScorecardSection.Scorecard.Tenant;

            secondScorecardSection = Presto.Persist <ScorecardSection>();
            secondTenant           = secondScorecardSection.Scorecard.Tenant;

            ClarityDB.Instance.SaveChanges();
            ClarityDB.CreateInstance(firstTenant.Users.First());
        }
Пример #14
0
        public override void SetUp()
        {
            base.SetUp();

            firstOpenAnswerDashboard = Presto.Persist <OpenAnswerDashboard>();
            firstTenant = firstOpenAnswerDashboard.Tenant;

            secondOpenAnswerDashboard = Presto.Persist <OpenAnswerDashboard>();
            secondTenant = secondOpenAnswerDashboard.Tenant;

            ClarityDB.Instance.SaveChanges();
            ClarityDB.CreateInstance(firstTenant.Users.First());
        }
Пример #15
0
        public override void SetUp()
        {
            base.SetUp();

            firstMenuTile = Presto.Persist <MenuTile>(x => x.Title = "First");
            firstTenant   = firstMenuTile.Tenant;

            secondMenuTile = Presto.Persist <MenuTile>(x => x.Title = "Second");
            secondTenant   = secondMenuTile.Tenant;

            ClarityDB.Instance.SaveChanges();
            ClarityDB.CreateInstance(firstMenuTile.Owner);
        }
        public void ReturnsScorecardUserIsAddedAsUser()
        {
            var scorecard = Presto.Persist <Scorecard>();
            var user      = CreateUser(scorecard.Tenant);

            scorecard.MenuTile.Members.Add(new Membership {
                User = user, UserID = user.ID
            });

            ClarityDB.Instance.SaveChanges();

            ClarityDB.CreateInstance(user);
            Assert.AreEqual(1, ClarityDB.Instance.Scorecards.Count());
        }
Пример #17
0
        public void ReturnsMenuTileUserIsAddedAsUser()
        {
            var menuTile = Presto.Persist <MenuTile>();
            var user     = CreateUser(menuTile.Tenant);

            menuTile.Members.Add(new Membership {
                User = user, UserID = user.ID
            });

            ClarityDB.Instance.SaveChanges();

            ClarityDB.CreateInstance(user);
            Assert.AreEqual(1, ClarityDB.Instance.MenuTiles.Count());
        }
        public override void SetUp()
        {
            base.SetUp();

            firstDataBatch = Presto.Persist <DataBatch>();
            firstTenant    = firstDataBatch.Tenant;

            secondDataBatch = Presto.Persist <DataBatch>();
            secondTenant    = secondDataBatch.Tenant;

            ClarityDB.Instance.SaveChanges();

            ClarityDB.CreateInstance(firstDataBatch.UploadedBy);
        }
Пример #19
0
        public override void SetUp()
        {
            base.SetUp();

            firstOption  = Presto.Persist <Option>();
            secondOption = Presto.Persist <Option>();

            var user = Presto.Create <User>();

            user.Tenant   = firstOption.Tenant;
            user.TenantID = firstOption.TenantID;
            firstOption.Tenant.Users.Add(user);

            ClarityDB.Instance.SaveChanges();
            ClarityDB.CreateInstance(user);
        }
        public void Remove_UserIsNotMember_ThrowsException()
        {
            var scorecard = Presto.Persist <Scorecard>();
            var user      = CreateUser(scorecard.Tenant);

            scorecard.MenuTile.Members.Add(new Membership {
                User = user, UserID = user.ID
            });

            var nonMember = CreateUser(scorecard.Tenant);

            ClarityDB.Instance.SaveChanges();
            ClarityDB.CreateInstance(nonMember);

            Assert.Throws <ArgumentOutOfRangeException>(() => ClarityDB.Instance.Scorecards.Remove(scorecard));
        }
        public void ReturnsPagesOfCanvasThatUserIsAddedAsUser()
        {
            var page = Presto.Persist <Page>();
            var user = CreateUser(page.Canvas.Tenant);

            page.Canvas.MenuTile.Members.Add(new Membership {
                User = user, UserID = user.ID
            });

            ClarityDB.CurrentTenant = page.Canvas.Tenant;
            ClarityDB.CurrentTenant.Canvases.Add(page.Canvas);
            ClarityDB.Instance.SaveChanges();

            ClarityDB.CreateInstance(user);
            Assert.AreEqual(1, ClarityDB.Instance.Pages.Count());
        }
        public void FiltersOtherPersonScorecard()
        {
            var scorecard = Presto.Persist <Scorecard>();
            var user      = CreateUser(scorecard.Tenant);

            scorecard.MenuTile.Members.Add(new Membership {
                User = user, UserID = user.ID
            });

            var nonMember = CreateUser(scorecard.Tenant);

            ClarityDB.Instance.SaveChanges();
            ClarityDB.CreateInstance(nonMember);

            Assert.AreEqual(0, ClarityDB.Instance.Scorecards.Count());
        }
        public override void SetUp()
        {
            base.SetUp();

            var user = Presto.Persist <User>();

            firstTenant             = user.Tenant;
            firstAssociatedVariable = Presto.Create <AssociatedVariable>();
            firstTenant.Datasets.Add(firstAssociatedVariable.VariableGroup.Dataset);

            secondTenant             = Presto.Persist <Tenant>();
            secondAssociatedVariable = Presto.Create <AssociatedVariable>();
            secondTenant.Datasets.Add(secondAssociatedVariable.VariableGroup.Dataset);

            ClarityDB.Instance.SaveChanges();
            ClarityDB.CreateInstance(user);
        }
        public override void SetUp()
        {
            base.SetUp();

            var user = Presto.Persist <User>();

            firstTenant          = user.Tenant;
            firstDashboardWizard = Presto.Create <DashboardWizard>(x => { x.TenantID = firstTenant.ID; x.Tenant = firstTenant; });
            ClarityDB.Instance.DashboardWizards.Add(firstDashboardWizard);

            secondTenant          = Presto.Persist <Tenant>();
            secondDashboardWizard = Presto.Create <DashboardWizard>(x => { x.TenantID = secondTenant.ID; x.Tenant = secondTenant; });
            ClarityDB.Instance.DashboardWizards.Add(secondDashboardWizard);

            ClarityDB.Instance.SaveChanges();

            ClarityDB.CreateInstance(user);
        }
Пример #25
0
        public override void SetUp()
        {
            base.SetUp();
            ClarityDB.CurrentTenant = Presto.Persist <Tenant>();
            firstFilter             = Presto.Persist <Filter>();
            firstTenant             = firstFilter.MenuTile.Tenant;

            ClarityDB.CurrentTenant = firstFilter.MenuTile.Tenant;
            ClarityDB.CurrentTenant.MenuTiles.Add(firstFilter.MenuTile);
            ClarityDB.Instance.SaveChanges();

            secondFilter = Presto.Persist <Filter>();
            secondTenant = secondFilter.MenuTile.Tenant;
            secondTenant.MenuTiles.Add(secondFilter.MenuTile);
            ClarityDB.CurrentTenant.MenuTiles.Add(secondFilter.MenuTile);
            ClarityDB.Instance.SaveChanges();
            ClarityDB.CreateInstance(firstTenant.Users.First());
        }
Пример #26
0
        public override void SetUp()
        {
            base.SetUp();

            var user = Presto.Persist <User>();

            firstTenant   = user.Tenant;
            firstCategory = Presto.Create <NumericCategory>();
            firstTenant.Datasets.Add(firstCategory.Variable.Dataset);

            secondTenant   = Presto.Persist <Tenant>();
            secondCategory = Presto.Create <NumericCategory>();
            secondTenant.Datasets.Add(secondCategory.Variable.Dataset);

            ClarityDB.Instance.SaveChanges();

            ClarityDB.CreateInstance(user);
        }
        public void ReturnsSectionsOfScorecardThatUserIsAddedAsGroup()
        {
            var section = Presto.Persist <ScorecardSection>();

            var group = CreateGroup(section.Scorecard.Tenant);

            section.Scorecard.MenuTile.Members.Add(new Membership {
                Group = group, GroupID = group.ID
            });

            var user = CreateUser(section.Scorecard.Tenant);

            group.Users.Add(user);

            ClarityDB.Instance.SaveChanges();

            ClarityDB.CreateInstance(user);
            Assert.AreEqual(1, ClarityDB.Instance.ScorecardSections.Count());
        }
Пример #28
0
        public void KeyFigure_CannotAddFigureOfAnotherTenant()
        {
            base.SetUp();

            var firstMenuTile = Presto.Persist <MenuTile>();

            firstTenant = firstMenuTile.Tenant;

            var secondMenuTile = Presto.Persist <MenuTile>();

            secondTenant = secondMenuTile.Tenant;

            ClarityDB.Instance.SaveChanges();
            ClarityDB.CreateInstance(firstTenant.Users.First());

            var figure = Presto.Create <Figure>(x => { x.PageID = null; x.Page = null; x.MenuTile = secondMenuTile; x.MenuTileID = x.MenuTile.ID; });

            Assert.Throws <ArgumentOutOfRangeException>(() => ClarityDB.Instance.Figures.Add(figure));
        }
Пример #29
0
        public void PageIDIsNull_FiltersFigure()
        {
            base.SetUp();

            var firstMenuTile = Presto.Persist <MenuTile>();

            firstFigure = Presto.Persist <Figure>(x => { x.PageID = null; x.Page = null; x.MenuTileID = firstMenuTile.ID; });
            firstTenant = firstMenuTile.Tenant;

            var secondMenuTile = Presto.Persist <MenuTile>();

            secondFigure = Presto.Persist <Figure>(x => { x.PageID = null; x.Page = null; x.MenuTileID = secondMenuTile.ID; });
            secondTenant = secondMenuTile.Tenant;

            ClarityDB.Instance.SaveChanges();
            ClarityDB.CreateInstance(firstTenant.Users.First());

            Assert.AreEqual(1, ClarityDB.Instance.Figures.Count());
            Assert.AreEqual(firstFigure.ID, ClarityDB.Instance.Figures.First().ID);
        }
        public void ReturnsFiguresOfCanvasThatUserIsAddedAsGroup()
        {
            var figure = Presto.Persist <Figure>();

            var group = CreateGroup(figure.Page.Canvas.Tenant);

            figure.Page.Canvas.MenuTile.Members.Add(new Membership {
                Group = group, GroupID = group.ID
            });

            var user = CreateUser(figure.Page.Canvas.Tenant);

            group.Users.Add(user);

            ClarityDB.CurrentTenant = figure.Page.Canvas.Tenant;
            ClarityDB.CurrentTenant.Canvases.Add(figure.Page.Canvas);
            ClarityDB.Instance.SaveChanges();

            ClarityDB.CreateInstance(user);
            Assert.AreEqual(1, ClarityDB.Instance.Figures.Count());
        }