Exemplo n.º 1
0
        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]);
        }
Exemplo n.º 2
0
        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");
        }
Exemplo n.º 3
0
        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]);
        }
Exemplo n.º 4
0
        public void TestMethod2()
        {
            //Testcase 1.2
            _mainViewModel.LoginOrLogoutBox = "45";
            Assert.AreEqual("45", _mainViewModel.LoginOrLogoutBox);

            _employeeHandler.LoginOrLogout(); //Employee logs in
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
        public void TestSculptureLastInspection()
        {
            // Arrange
            _sculptureLastInspection = DateTime.Today;

            // Act
            _testSculpture.LastInspection = _sculptureLastInspection;

            // Assert
            Assert.AreEqual(_sculptureLastInspection, _testSculpture.LastInspection);
        }
Exemplo n.º 7
0
        public void TestSculptureCulturalHeritage()
        {
            //Arrange
            _sculptureCulturalHeritage = "High";

            //Act
            _testSculpture.Cultural_Heritage = _sculptureCulturalHeritage;

            //Assert
            Assert.AreEqual(_sculptureCulturalHeritage, _testSculpture.Cultural_Heritage);
        }
Exemplo n.º 8
0
        public void TestNormalId()
        {
            //Arrange
            _sculptureId = 7;

            //Act
            _testSculpture.ID = _sculptureId;

            //Assert
            Assert.AreEqual(_sculptureId, _testSculpture.ID);
        }
Exemplo n.º 9
0
        public void TestNullInspectionFrequency()
        {
            //Arrange
            _sculptureInspectionFrequency = null;

            //Act
            _testSculpture.Sculpture_Inspection_Frequency = _sculptureInspectionFrequency;

            //Assert
            Assert.AreEqual(_sculptureInspectionFrequency, _testSculpture.Sculpture_Inspection_Frequency);
        }
Exemplo n.º 10
0
        public void TestEmptyInspectionFrequency()
        {
            //Arrange
            _sculptureInspectionFrequency = string.Empty;

            //Act
            _testSculpture.Sculpture_Inspection_Frequency = _sculptureInspectionFrequency;

            //Assert
            Assert.AreEqual(_sculptureInspectionFrequency, _testSculpture.Sculpture_Inspection_Frequency);
        }
Exemplo n.º 11
0
        public void TestInspectionFrequency()
        {
            //Arrange
            _sculptureInspectionFrequency = "Twice per year.";

            //Act
            _testSculpture.Sculpture_Inspection_Frequency = _sculptureInspectionFrequency;

            //Assert
            Assert.AreEqual(_sculptureInspectionFrequency, _testSculpture.Sculpture_Inspection_Frequency);
        }
Exemplo n.º 12
0
        public void TestShortDescription()
        {
            //Arrange
            _sculptureDescription = "AB";

            //Act
            _testSculpture.Sculpture_Description = _sculptureDescription;

            //Assert
            Assert.AreEqual(_sculptureDescription, _testSculpture.Sculpture_Description);
        }
Exemplo n.º 13
0
        public void TestNullDescription()
        {
            //Arrange
            _sculptureDescription = null;

            //Act
            _testSculpture.Sculpture_Description = _sculptureDescription;

            //Assert
            Assert.AreEqual(_sculptureDescription, _testSculpture.Sculpture_Description);
        }
Exemplo n.º 14
0
        public void TestEmptyDescription()
        {
            //Arrange
            _sculptureDescription = string.Empty;

            //Act
            _testSculpture.Sculpture_Description = _sculptureDescription;

            //Assert
            Assert.AreEqual(_sculptureDescription, _testSculpture.Sculpture_Description);
        }
Exemplo n.º 15
0
        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);
        }
Exemplo n.º 16
0
        public void TestPlacement()
        {
            //Arrange
            _sculpturePlacement = "Ground";

            //Act
            _testSculpture.Sculpture_Placement = _sculpturePlacement;

            //Assert
            Assert.AreEqual(_sculpturePlacement, _testSculpture.Sculpture_Placement);
        }
Exemplo n.º 17
0
        public void TestSculpturePicture()
        {
            //Arrange
            _sculpturePicture = "..//Assets//picture.png";

            //Act
            _testSculpture.Sculpture_Picture = _sculpturePicture;

            //Assert
            Assert.AreEqual(_sculpturePicture, _testSculpture.Sculpture_Picture);
        }
Exemplo n.º 18
0
        public void TestNullSculpturePicture()
        {
            //Arrange
            _sculpturePicture = null;

            //Act
            _testSculpture.Sculpture_Picture = _sculpturePicture;

            //Assert
            Assert.AreEqual(_sculpturePicture, _testSculpture.Sculpture_Picture);
        }
Exemplo n.º 19
0
        public void TestName()
        {
            //Arrange
            _sculptureName = "Skulptur";

            //Act
            _testSculpture.Sculpture_Name = _sculptureName;

            //Assert
            Assert.AreEqual(_sculptureName, _testSculpture.Sculpture_Name);
        }
Exemplo n.º 20
0
        public void TestAddress()
        {
            //Arrange
            _sculptureAddress = "Frederiksberg";

            //Act
            _testSculpture.Sculpture_Address = _sculptureAddress;

            //Assert
            Assert.AreEqual(_sculptureAddress, _testSculpture.Sculpture_Address);
        }
Exemplo n.º 21
0
        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.
        }
Exemplo n.º 22
0
        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);
        }
Exemplo n.º 23
0
        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
        }
Exemplo n.º 24
0
        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);
        }
Exemplo n.º 25
0
        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));
        }
Exemplo n.º 26
0
        public void TestSculptureTypes()
        {
            // Arrange
            _sculptureTypes = new List <string> {
                "Skulptur"
            };

            // Act
            _testSculpture.SculptureTypes = _sculptureTypes;

            // Assert
            Assert.AreEqual(_sculptureTypes, _testSculpture.SculptureTypes);
        }
Exemplo n.º 27
0
        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.");
            }
        }
Exemplo n.º 28
0
        public void TestSculptureMaterials()
        {
            // Arrange
            _sculptureMaterials = new List <Material>()
            {
                new Material("Marmor")
            };

            // Act
            _testSculpture.SculptureMaterials = _sculptureMaterials;

            // Assert
            Assert.AreEqual(_sculptureMaterials, _testSculpture.SculptureMaterials);
        }
Exemplo n.º 29
0
        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.");
            }
        }
Exemplo n.º 30
0
        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);
        }