public void Test_AdvancedCollectionView_Filter_Preserves_Order() { var l = new ObservableCollection <string> { "lorem", "ipsum", "dolor", "sit", "amet" }; var a = new AdvancedCollectionView(l) { Filter = (x) => x.ToString().Length < 5 }; Assert.AreEqual(2, a.Count); Assert.AreEqual("sit", a[0]); Assert.AreEqual("amet", a[1]); a.Insert(4, "how"); Assert.AreEqual(3, a.Count); Assert.AreEqual("sit", a[0]); Assert.AreEqual("how", a[1]); Assert.AreEqual("amet", a[2]); }
public void Test_AdvancedCollectionView_Filter_Preserves_Order_When_Inserting_After_Items_In_View() { var l = new ObservableCollection <string> { "lorem", "ipsum", "dolor", "sitter", "amet" }; var a = new AdvancedCollectionView(l) { Filter = (x) => x.ToString().Length < 5 }; Assert.AreEqual(1, a.Count); Assert.AreEqual(a[0], "amet"); a.Insert(0, "how"); Assert.AreEqual(2, a.Count); Assert.AreEqual(a[0], "how"); Assert.AreEqual(a[1], "amet"); }
public void Test_AdvancedCollectionView_Updating_Filter_Preserves_Order_With_Duplicate() { var l = new ObservableCollection <string> { "lorem", "ipsum", "dolor", "sit", "ipsum", "amet" }; var a = new AdvancedCollectionView(l) { Filter = (x) => x.ToString().Length < 5 }; Assert.AreEqual(2, a.Count); Assert.AreEqual("sit", a[0]); Assert.AreEqual("amet", a[1]); a.Filter = (x) => x.ToString().Length >= 5; Assert.AreEqual(4, a.Count); Assert.AreEqual("lorem", a[0]); Assert.AreEqual("ipsum", a[1]); Assert.AreEqual("dolor", a[2]); Assert.AreEqual("ipsum", a[3]); }
public void TestMethod2() { //Testcase 1.2 _mainViewModel.LoginOrLogoutBox = "45"; Assert.AreEqual("45", _mainViewModel.LoginOrLogoutBox); _employeeHandler.LoginOrLogout(); //Employee logs in }
public void Test_AdvancedCollectionView_Combined_Using_Shaping_Changing_Properties() { var personLorem = new Person() { Name = "lorem", Age = 4 }; var l = new ObservableCollection <Person> { personLorem, new Person() { Name = "imsum", Age = 8 }, new Person() { Name = "dolor", Age = 15 }, new Person() { Name = "sit", Age = 16 }, new Person() { Name = "amet", Age = 23 }, new Person() { Name = "consectetur", Age = 42 }, }; var a = new AdvancedCollectionView(l, true) { SortDescriptions = { new SortDescription(nameof(Person.Age), SortDirection.Descending) }, Filter = (x) => ((Person)x).Name.Length > 5 }; a.ObserveFilterProperty(nameof(Person.Name)); Assert.AreEqual(42, ((Person)a.First()).Age); Assert.AreEqual(1, a.Count); personLorem.Name = "lorems"; personLorem.Age = 96; Assert.AreEqual(96, ((Person)a.First()).Age); Assert.AreEqual(2, a.Count); }
public void TestSculptureLastInspection() { // Arrange _sculptureLastInspection = DateTime.Today; // Act _testSculpture.LastInspection = _sculptureLastInspection; // Assert Assert.AreEqual(_sculptureLastInspection, _testSculpture.LastInspection); }
public void TestSculptureCulturalHeritage() { //Arrange _sculptureCulturalHeritage = "High"; //Act _testSculpture.Cultural_Heritage = _sculptureCulturalHeritage; //Assert Assert.AreEqual(_sculptureCulturalHeritage, _testSculpture.Cultural_Heritage); }
public void TestNormalId() { //Arrange _sculptureId = 7; //Act _testSculpture.ID = _sculptureId; //Assert Assert.AreEqual(_sculptureId, _testSculpture.ID); }
public void TestNullInspectionFrequency() { //Arrange _sculptureInspectionFrequency = null; //Act _testSculpture.Sculpture_Inspection_Frequency = _sculptureInspectionFrequency; //Assert Assert.AreEqual(_sculptureInspectionFrequency, _testSculpture.Sculpture_Inspection_Frequency); }
public void TestEmptyInspectionFrequency() { //Arrange _sculptureInspectionFrequency = string.Empty; //Act _testSculpture.Sculpture_Inspection_Frequency = _sculptureInspectionFrequency; //Assert Assert.AreEqual(_sculptureInspectionFrequency, _testSculpture.Sculpture_Inspection_Frequency); }
public void TestInspectionFrequency() { //Arrange _sculptureInspectionFrequency = "Twice per year."; //Act _testSculpture.Sculpture_Inspection_Frequency = _sculptureInspectionFrequency; //Assert Assert.AreEqual(_sculptureInspectionFrequency, _testSculpture.Sculpture_Inspection_Frequency); }
public void TestShortDescription() { //Arrange _sculptureDescription = "AB"; //Act _testSculpture.Sculpture_Description = _sculptureDescription; //Assert Assert.AreEqual(_sculptureDescription, _testSculpture.Sculpture_Description); }
public void TestNullDescription() { //Arrange _sculptureDescription = null; //Act _testSculpture.Sculpture_Description = _sculptureDescription; //Assert Assert.AreEqual(_sculptureDescription, _testSculpture.Sculpture_Description); }
public void TestEmptyDescription() { //Arrange _sculptureDescription = string.Empty; //Act _testSculpture.Sculpture_Description = _sculptureDescription; //Assert Assert.AreEqual(_sculptureDescription, _testSculpture.Sculpture_Description); }
public void TestDescription() { //Arrange _sculptureDescription = "The most important sculpture in the North of Copenhagen."; //Act _testSculpture.Sculpture_Description = _sculptureDescription; //Assert Assert.AreEqual(_sculptureDescription, _testSculpture.Sculpture_Description); }
public void TestPlacement() { //Arrange _sculpturePlacement = "Ground"; //Act _testSculpture.Sculpture_Placement = _sculpturePlacement; //Assert Assert.AreEqual(_sculpturePlacement, _testSculpture.Sculpture_Placement); }
public void TestSculpturePicture() { //Arrange _sculpturePicture = "..//Assets//picture.png"; //Act _testSculpture.Sculpture_Picture = _sculpturePicture; //Assert Assert.AreEqual(_sculpturePicture, _testSculpture.Sculpture_Picture); }
public void TestNullSculpturePicture() { //Arrange _sculpturePicture = null; //Act _testSculpture.Sculpture_Picture = _sculpturePicture; //Assert Assert.AreEqual(_sculpturePicture, _testSculpture.Sculpture_Picture); }
public void TestName() { //Arrange _sculptureName = "Skulptur"; //Act _testSculpture.Sculpture_Name = _sculptureName; //Assert Assert.AreEqual(_sculptureName, _testSculpture.Sculpture_Name); }
public void TestAddress() { //Arrange _sculptureAddress = "Frederiksberg"; //Act _testSculpture.Sculpture_Address = _sculptureAddress; //Assert Assert.AreEqual(_sculptureAddress, _testSculpture.Sculpture_Address); }
public void TestMethod3() { //Testcase 1.3 _mainViewModel.LoginOrLogoutBox = "22"; Assert.AreEqual("22", _mainViewModel.LoginOrLogoutBox); var lastLoginBeforeLogin = _testEmployee.LastLogin; _employeeHandler.LoginOrLogout(); //Employee logs in Assert.AreNotEqual(_testEmployee.LastLogin, lastLoginBeforeLogin); //Checks if the last logged in employee has had his LastLogin attribute updated properly. }
public void TestMethod6() { //Testcase 1.6 _mainViewModel.LoginOrLogoutBox = "50"; Assert.AreEqual("50", _mainViewModel.LoginOrLogoutBox); var totalHoursBeforeLogout = _testEmployee2.TotalHours; _employeeHandler.LoginOrLogout(); //Employee logs out Assert.AreNotEqual(_testEmployee2.TotalHours, totalHoursBeforeLogout); }
public void TestMethod11() { //Testcase 3.3 _mainViewModel.LoginOrLogoutBox = "15"; Assert.AreEqual(_mainViewModel.LoginOrLogoutBox, "15"); _employeeHandler.LoginOrLogout(); //Admin level 2 logs in _employeeHandler.SelectedEmployee = _testEmployee; //Admin lvl 2 selects an employee outside of his department. _employeeHandler.AdminChangePersonalInfo(); //Success }
public void TestMethod5() { //Testcase 1.5 _mainViewModel.LoginOrLogoutBox = "50"; Assert.AreEqual("50", _mainViewModel.LoginOrLogoutBox); var lastLogoutBeforeLogout = _testEmployee2.LastLogout; _employeeHandler.LoginOrLogout(); //Employee logs out Assert.AreNotEqual(_testEmployee2.LastLogout, lastLogoutBeforeLogout); }
public void TestMethod4() { //Testcase 1.4 _mainViewModel.LoginOrLogoutBox = "50"; Assert.AreEqual("50", _mainViewModel.LoginOrLogoutBox); _employeeHandler.LoginOrLogout(); _mainViewModel.LoggedInEmployees.Clear(); //Simulates the removal of the employee from the logged in table using the DeleteDataLoggedIn() method. Assert.IsFalse(_mainViewModel.LoggedInEmployees.Contains(_testEmployee2)); }
public void TestSculptureTypes() { // Arrange _sculptureTypes = new List <string> { "Skulptur" }; // Act _testSculpture.SculptureTypes = _sculptureTypes; // Assert Assert.AreEqual(_sculptureTypes, _testSculpture.SculptureTypes); }
public void TestMethod9() { //Testcase 3.1 _employeeHandler.SelectedEmployee = null; //No employee has been selected from the list. try { _employeeHandler.AdminChangePersonalInfo(); } catch (NullReferenceException ex) { Assert.AreEqual(ex.Message, "Please select an employee to edit."); } }
public void TestSculptureMaterials() { // Arrange _sculptureMaterials = new List <Material>() { new Material("Marmor") }; // Act _testSculpture.SculptureMaterials = _sculptureMaterials; // Assert Assert.AreEqual(_sculptureMaterials, _testSculpture.SculptureMaterials); }
public void TestMethod1() { //Testcase 1.1 _mainViewModel.LoginOrLogoutBox = "89"; Assert.AreEqual("89", _mainViewModel.LoginOrLogoutBox); try { _employeeHandler.LoginOrLogout(); //Employee logs in } catch (ArgumentException ex) { Assert.AreEqual(ex.Message, "Please enter a valid employee id."); } }
public void TestMethod8() { //Testcase 2.2 _mainViewModel.LoginOrLogoutBox = "22"; Assert.AreEqual("22", _mainViewModel.LoginOrLogoutBox); Assert.AreEqual(_testEmployee.VacationDays, 0); _employeeHandler.LoginOrLogout(); //Employee logs in DanxMainPage.VacationDayRButton.IsChecked = true; _employeeHandler.ChangeVacationOrSickdays(); Assert.AreEqual(_employeeHandler.LastLoggedIn.VacationDays, 1); }