Пример #1
0
        public void AllTablesViewModel_InstantiateViewModelropertiesWithOneLocation_Null_Parameter_Should_Pass()
        {
            // Arrange
            var viewModel = new AllTablesViewModel();
            var mockData  = new LocationsDataMock();

            viewModel.locations = mockData.GetAllViewModelList();

            // Act
            var result = viewModel.InstatiateViewModelPropertiesWithOneLocation();

            // Assert
            Assert.IsTrue(result);
        }
Пример #2
0
        public void AllTablesViewModel_ConvertStringToBooleanEnum_Parameter_Yes_Should_Pass()
        {
            // Arrange
            var mockData  = new LocationsDataMock();
            var location  = mockData.GetAllViewModelList()[0];
            var viewModel = new AllTablesViewModel();


            var properties = typeof(SpecialQualities).GetProperties(); // All properties of DailyHours is null by default
            var specialQualitiesPropertyNameList = new List <string>();

            foreach (var property in properties)
            {
                if (property.Name.Equals("LocationId") ||
                    property.Name.Equals("AccessNotes") ||
                    property.Name.Equals("InstallationType") ||
                    property.Name.Equals("Location") ||
                    property.Name.Equals("CoinStar") ||
                    property.Name.Equals("TellerServices") ||
                    property.Name.Equals("_24hourExpressBox") ||
                    property.Name.Equals("PartnerCreditUnion") ||
                    property.Name.Equals("MemberConsultant") ||
                    property.Name.Equals("InstantDebitCardReplacement"))
                {
                    continue;
                }

                property.SetValue(location.SpecialQualities, "Y");
                specialQualitiesPropertyNameList.Add(property.Name);
            }
            // Act
            viewModel.InstatiateViewModelPropertiesWithOneLocation(location);


            // Assert
            properties = typeof(AllTablesViewModel).GetProperties();
            foreach (var property in properties)
            {
                if (!specialQualitiesPropertyNameList.Contains(property.Name))
                {
                    continue;
                }

                Assert.AreEqual(BooleanEnum.Y, property.GetValue(viewModel));
            }
        }
        public void AllTablesViewModel_ConvertStringToBooleanEnum_Parameter_Null_Should_Pass()
        {
            // Arrange
            var mockData  = new LocationsDataMock();
            var location  = mockData.GetAllViewModelList()[0];
            var viewModel = new AllTablesViewModel();


            var properties = typeof(SpecialQualities).GetProperties(); // All properties of DailyHours is null by default
            var specialQualitiesPropertyNameList = new List <string>();

            foreach (var property in properties)
            {
                if (property.Name.Equals("LocationId") || property.Name.Equals("Location"))
                {
                    continue;
                }

                property.SetValue(location.SpecialQualities, null);
                specialQualitiesPropertyNameList.Add(property.Name);
            }
            // Act
            viewModel.InstatiateViewModelPropertiesWithOneLocation(location);


            // Assert
            properties = typeof(AllTablesViewModel).GetProperties();
            foreach (var property in properties)
            {
                if (specialQualitiesPropertyNameList.Contains(property.Name))
                {
                    if (property.Name.Equals("InstallationType") || property.Name.Equals("AccessNotes"))
                    {
                        continue;
                    }


                    Assert.AreEqual(BooleanEnum.NULL, property.GetValue(viewModel));
                }
            }
        }