Example #1
0
        public void GetData_FiltersByIds()
        {
            lookup.Filter.Ids.Add("9I");
            lookup.Filter.Ids.Add("15I");
            lookup.Filter.Sort   = "Count";
            lookup.Filter.Search = "Term";
            lookup.Filter.Selected.Add("17I");
            lookup.Filter.AdditionalFilters.Add("Value", "5V");

            LookupData actual = lookup.GetData();

            Assert.Equal(new DateTime(2014, 12, 19).ToString("d"), actual.Rows[0]["Date"]);
            Assert.Equal("9V", actual.Rows[0]["Label"]);
            Assert.Equal("9V", actual.Rows[0]["Value"]);
            Assert.Equal("19", actual.Rows[0]["Count"]);
            Assert.Equal("9I", actual.Rows[0]["Id"]);

            Assert.Equal(new DateTime(2014, 12, 25).ToString("d"), actual.Rows[1]["Date"]);
            Assert.Equal("15V", actual.Rows[1]["Label"]);
            Assert.Equal("15V", actual.Rows[1]["Value"]);
            Assert.Equal("25", actual.Rows[1]["Count"]);
            Assert.Equal("15I", actual.Rows[1]["Id"]);

            Assert.Equal(lookup.Columns, actual.Columns);
            Assert.Equal(2, actual.FilteredRows);
            Assert.Equal(2, actual.Rows.Count);
        }
        public void GetData_FiltersByIds()
        {
            lookup.Filter.Ids.Add("9I");
            lookup.Filter.Ids.Add("15I");
            lookup.Filter.Search = "Term";
            lookup.Filter.Selected.Add("17I");
            lookup.Filter.Sort = nameof(TestModel.Count);
            lookup.Filter.AdditionalFilters.Add(nameof(TestModel.Value), "5Value");

            LookupData actual = lookup.GetData();

            Assert.Equal(new DateTime(2014, 12, 19).ToString("d"), actual.Rows[0][nameof(TestModel.Date)]);
            Assert.Equal("9Value10", actual.Rows[0][nameof(TestModel.Value)]);
            Assert.Equal("19", actual.Rows[0][nameof(TestModel.Count)]);
            Assert.Equal("9I", actual.Rows[0][nameof(TestModel.Id)]);
            Assert.Equal("9Value10", actual.Rows[0]["Label"]);

            Assert.Equal(new DateTime(2014, 12, 25).ToString("d"), actual.Rows[1][nameof(TestModel.Date)]);
            Assert.Equal("15Value16", actual.Rows[1][nameof(TestModel.Value)]);
            Assert.Equal("25", actual.Rows[1][nameof(TestModel.Count)]);
            Assert.Equal("15I", actual.Rows[1][nameof(TestModel.Id)]);
            Assert.Equal("15Value16", actual.Rows[1]["Label"]);

            Assert.Equal(lookup.Columns, actual.Columns);
            Assert.Equal(2, actual.Rows.Count);
            Assert.Empty(actual.Selected);
        }
Example #3
0
        public void GetData_FiltersById()
        {
            lookup.Filter.Id     = "9I";
            lookup.Filter.Search = "Term";
            lookup.Filter.AdditionalFilters.Add("Value", "5V");

            LookupData actual = lookup.GetData();

            Assert.Equal(new DateTime(2014, 12, 19).ToShortDateString(), actual.Rows[0]["Date"]);
            Assert.Equal("9V", actual.Rows[0][MvcLookup.AcKey]);
            Assert.Equal("9I", actual.Rows[0][MvcLookup.IdKey]);
            Assert.Equal("9V", actual.Rows[0]["Value"]);
            Assert.Equal("19", actual.Rows[0]["Count"]);

            Assert.Equal(lookup.Columns, actual.Columns);
            Assert.Equal(1, actual.FilteredRows);
            Assert.Single(actual.Rows);
        }