Esempio n. 1
0
        public void AddActionLink_OnModelWihoutKeyPropertyThrows()
        {
            Func <Object, String>          deleteFunc    = null;
            IGridColumn <Object>           objectColumn  = SubstituteColumn <Object>();
            IGridColumnCollection <Object> objectColumns = SubstituteColumns <Object, String>(objectColumn);

            objectColumn
            .RenderValueAs(Arg.Any <Func <Object, String> >())
            .Returns(objectColumn)
            .AndDoes(info =>
            {
                deleteFunc = info.Arg <Func <Object, String> >();
            });

            objectColumns.AddActionLink(LinkAction.Delete);

            Exception expected = Assert.Throws <Exception>(() => deleteFunc.Invoke(new Object()));

            Assert.AreEqual(expected.Message, "Object type does not have a key property.");
        }
Esempio n. 2
0
        public void AddActionLink_OnModelWihoutKeyPropertyThrows()
        {
            Func <Object, String>          renderer      = null;
            IGridColumn <Object>           objectColumn  = SubstituteColumn <Object>();
            IGridColumnCollection <Object> objectColumns = SubstituteColumns <Object, String>(objectColumn);

            objectColumn
            .RenderValueAs(Arg.Any <Func <Object, String> >())
            .Returns(objectColumn)
            .AndDoes(info =>
            {
                renderer = info.Arg <Func <Object, String> >();
            });

            objectColumns.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.AreEqual(expected, actual);
        }
Esempio n. 3
0
        public void AddActionLink_OnUnauthorizedActionLinkReturnsNull()
        {
            Authorization.Provider.IsAuthorizedFor(Arg.Any <String>(), Arg.Any <String>(), Arg.Any <String>(), Arg.Any <String>()).Returns(false);

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