예제 #1
0
        public void Given_Year_And_Country_Match_WithSalesData_When_FilterResult__ThenReturnAllMatch()
        {
            CarSalesViewModel salesUnderTest = new CarSalesViewModel()
            {
                AllSales                = testSales,
                SelectedYear            = 2021,
                SelectedStateCollection = new ObservableCollection <string> {
                    "Idaho", "Alabama"
                },
                SelectedCountry = new Country {
                    CountryName = "United States"
                }
            };

            salesUnderTest.FilterResult();
            Assert.AreEqual(3, salesUnderTest.SelectedSales.Count);
        }
예제 #2
0
        public void Given_Month_NoCity_AsInput_When_FilterResult_ThenFilterIncludeMonth()
        {
            CarSalesViewModel salesUnderTest = new CarSalesViewModel()
            {
                AllSales                = testSales,
                SelectedYear            = 2021,
                SelectedMonth           = "January",
                SelectedStateCollection = new ObservableCollection <string> {
                    "Idaho", "Alabama"
                },
                SelectedCountry = new Country {
                    CountryName = "United States"
                }
            };

            salesUnderTest.FilterResult();
            Assert.AreEqual(2, salesUnderTest.SelectedSales.Count);
        }
예제 #3
0
        public void Given_City_ButNoMonth_AsInput_When_FilterResult_ThenFilterIncludeCity()
        {
            CarSalesViewModel salesUnderTest = new CarSalesViewModel()
            {
                AllSales       = testSales,
                SelectedYear   = 2021,
                SelectedCities = new ObservableCollection <City> {
                    new City {
                        Name = "ABC"
                    }
                },
                SelectedStateCollection = new ObservableCollection <string> {
                    "Idaho", "Alabama"
                },
                SelectedCountry = new Country {
                    CountryName = "United States"
                }
            };

            salesUnderTest.FilterResult();
            Assert.AreEqual(1, salesUnderTest.SelectedSales.Count);
        }