public void Serialization_Works_As_Expected_For_Known_Plugins()
        {
            // arrange
            ColVisDatatablePlugin cvdp = new ColVisDatatablePlugin {
                aiExclude = new[] { 0, 1, 4 }
            };

            DefaultDatatableButton btn = new DefaultDatatableButton
            {
                text   = "Sample Button",
                action = DefaultDatatableButton.GetDefaultActionFunc()
            };

            btn.action.Body = "alert('hello mihir');";

            ButtonsDatatablePlugin bdp = new ButtonsDatatablePlugin();

            bdp.buttons.Add(btn);

            DatatableSettings s = new DatatableSettings();

            s.Plugins.AddRange(new IDatatablePlugin <object> [] { cvdp, bdp });

            const string expected = "{\r\n  \"bLengthChange\": false,\r\n  \"bPaginate\": false,\r\n  \"bServerSide\": false,\r\n  \"iDisplayLength\": 10,\r\n  \"oColVis\": {\r\n    \"aiExclude\": [\r\n      0,\r\n      1,\r\n      4\r\n    ]\r\n  },\r\n  \"buttons\": [\r\n    {\r\n      \"text\": \"Sample Button\",\r\n      \"action\": function (e, dt, node, config) { alert('hello mihir'); }\r\n    }\r\n  ]\r\n}";

            // act
            string json = s.ToString();

            // assert
            Assert.AreEqual(expected, json);
        }
        public void Serialization_Includes_Plugin_Options_In_Root_Object()
        {
            // arrange
            SamplePlugin      p = new SamplePlugin();
            DatatableSettings s = new DatatableSettings();

            s.Plugins.Add(p);

            const string expectedJson = "{\r\n  \"bLengthChange\": false,\r\n  \"bPaginate\": false,\r\n  \"bServerSide\": false,\r\n  \"iDisplayLength\": 10,\r\n  \"oSamplePlugin\": {\r\n    \"oSampleField\": 1234,\r\n    \"oSampleProperty\": \"mihir-mone\"\r\n  }\r\n}";

            // act
            string json = s.ToString();

            // assert
            Assert.AreEqual(expectedJson, json);
        }