public void AddActionLink_Unauthorized_Empty()
        {
            Authorization.Provider   = Substitute.For <IAuthorizationProvider>();
            columns.Grid.HttpContext = HttpContextFactory.CreateHttpContextBase();

            IGridColumn <AllTypesView> actual = columns.AddActionLink("Edit", "fa fa-pencil");

            Assert.Empty(actual.ValueFor(null).ToString());
            Assert.Empty(columns);
        }
Esempio n. 2
0
        public void AddActionLink_OnUnauthorizedActionLinkDoesNotAddColumn()
        {
            Authorization.Provider   = Substitute.For <IAuthorizationProvider>();
            columns.Grid.HttpContext = HttpContextFactory.CreateHttpContextBase();

            columns.AddActionLink("Edit", "fa fa-pencil");

            columns.DidNotReceive().Add(Arg.Any <Expression <Func <AllTypesView, String> > >());
            columns.DidNotReceive().Insert(Arg.Any <Int32>(), Arg.Any <Expression <Func <AllTypesView, String> > >());
        }
Esempio n. 3
0
        public void AddActionLink_OnModelWihoutKeyPropertyThrows()
        {
            Func <Object, String> renderer = null;
            IGridColumn <Object>  column   = SubstituteColumn <Object>();
            IGridColumns <Object> columns  = SubstituteColumns <Object, String>(column);

            columns
            .Add(Arg.Any <Expression <Func <Object, String> > >())
            .Returns(column)
            .AndDoes(info =>
            {
                renderer = info.Arg <Expression <Func <Object, String> > >().Compile();
            });

            columns.AddActionLink("Delete", "fa fa-times");

            String actual   = Assert.Throws <Exception>(() => renderer.Invoke(new Object())).Message;
            String expected = "Object type does not have a key property.";

            Assert.Equal(expected, actual);
        }