예제 #1
0
        public void testPersistence()
        {
            DataProvider dataProvider = new DataProvider();
            SampleDataGroup dataSource = new SampleDataGroup("1", "test", "subtest", "none", "desc");

            DataProvider dataProvider2 = new DataProvider();
            SampleDataGroup dataSource2 = new SampleDataGroup("2", "test2", "subtest2", "none2", "desc2");

            dataProvider.setGroup(dataSource);
            dataProvider2.setGroup(dataSource2);

            Assert.AreEqual(8, dataProvider2.getCount());
        }
예제 #2
0
        public void testCount()
        {
            DataProvider dataProvider = new DataProvider();
            SampleDataGroup dataSource = new SampleDataGroup("1", "test", "subtest", "none", "desc");

            dataProvider.setGroup(dataSource);
            dataProvider.setGroup(dataSource);
            dataProvider.setGroup(dataSource);
            dataProvider.setGroup(dataSource);
            dataProvider.setGroup(dataSource);

            Assert.AreEqual(6, dataProvider.getCount());
        }
        public SampleDataSource()
        {
            // this should load local data, cause it's executed once
            DataProvider.readData();
            // TODO: delete this at the end.
            String ITEM_CONTENT = String.Format("Item Content: {0}\n\n{0}\n\n{0}\n\n{0}\n\n{0}\n\n{0}\n\n{0}",
                        "Curabitur class aliquam vestibulum nam curae maecenas sed integer cras phasellus suspendisse quisque donec dis praesent accumsan bibendum pellentesque condimentum adipiscing etiam consequat vivamus dictumst aliquam duis convallis scelerisque est parturient ullamcorper aliquet fusce suspendisse nunc hac eleifend amet blandit facilisi condimentum commodo scelerisque faucibus aenean ullamcorper ante mauris dignissim consectetuer nullam lorem vestibulum habitant conubia elementum pellentesque morbi facilisis arcu sollicitudin diam cubilia aptent vestibulum auctor eget dapibus pellentesque inceptos leo egestas interdum nulla consectetuer suspendisse adipiscing pellentesque proin lobortis sollicitudin augue elit mus congue fermentum parturient fringilla euismod feugiat");

            DataProvider dataProvider = new DataProvider();
            var group = new SampleDataGroup("Group-1",
                    "Group Title: 1",
                    "Group Subtitle: 1",
                    "Assets/DarkGray.png",
                    "smaller to see where it is");
            group.Items.Add(new SampleDataItem("Group-1-Item-1",
                    "Item Title: 1",
                    "Item Subtitle: 1",
                    "Assets/LightGray.png",
                    "Item Description: Pellentesque porta, mauris quis interdum vehicula, urna sapien ultrices velit, nec venenatis dui odio in augue. Cras posuere, enim a cursus convallis, neque turpis malesuada erat, ut adipiscing neque tortor ac erat.",
                    ITEM_CONTENT,
                    group));
            group.Items.Add(new SampleDataItem("Group-1-Item-2",
                    "Item Title: 2",
                    "Item Subtitle: 2",
                    "Assets/DarkGray.png",
                    "Item Description: Pellentesque porta, mauris quis interdum vehicula, urna sapien ultrices velit, nec venenatis dui odio in augue. Cras posuere, enim a cursus convallis, neque turpis malesuada erat, ut adipiscing neque tortor ac erat.",
                    ITEM_CONTENT,
                    group));

            dataProvider.setGroup(group);
            //var group1 = dataProvider.getGroup(1);
            //

            //  dataProvider.getData();
            int iCount = dataProvider.getCount();
            if (iCount > 0)
            {
                for (int i = 0; i < iCount; i++)
                {
                    group = dataProvider.getGroup(i);

                    this.AllGroups.Add(group);
                }
            }
        }