public void GetLicencesByLastModifiedPersonId()
        {
            Person person = new Person { id = 5, name = "Jan", surname = "Kowalski" };

            Mock<ILicenceRepository> mock = new Mock<ILicenceRepository>();
            mock.Setup(a => a.Licences).Returns(new Licence[]
            {
                new Licence { id_number = 1, inventory_number = "aaaa", last_modified_id = person.id },
                new Licence { id_number = 2, inventory_number = "bbbb", last_modified_id = 4 },
                new Licence { id_number = 3, inventory_number = "cccc", last_modified_id = person.id },
                new Licence { id_number = 4, inventory_number = "dddd", last_modified_id = 2 },
                new Licence { id_number = 5, inventory_number = "eeee", last_modified_id = person.id }
            }.AsQueryable());

            LicenceController ctrl = new LicenceController(mock.Object);
            Object[] temp = ctrl.GetLicencesByLastModifiedPersonId(person.id);
            Assert.AreEqual(temp.Length, 3);
            Assert.AreEqual(((Licence)temp[2]).inventory_number, "eeee");

            temp = ctrl.GetLicencesByLastModifiedPersonId(2);
            Assert.AreEqual(temp.Length, 1);
            Assert.AreEqual(((Licence)temp[0]).inventory_number, "dddd");

            temp = ctrl.GetLicencesByLastModifiedPersonId(52);
            Assert.AreEqual(temp.Length, 0);
        }
        public void GetLicencesByCreatorOrLastModifiedPersonID()
        {
            Person person = new Person { id = 4, name = "Jan", surname = "Kowalski" };
            Mock<ILicenceRepository> mock = new Mock<ILicenceRepository>();
            mock.Setup(a => a.Licences).Returns(new Licence[]
            {
                new Licence { id_number = 1, inventory_number = "aaaa", created_by = person.id, last_modified_id = 9 },
                new Licence { id_number = 2, inventory_number = "bbbb", created_by = 2, last_modified_id = 2},
                new Licence { id_number = 3, inventory_number = "cccc", created_by = 3, last_modified_id = 9},
                new Licence { id_number = 4, inventory_number = "dddd", created_by = person.id, last_modified_id = 9},
                new Licence { id_number = 5, inventory_number = "eeee", created_by = 1, last_modified_id = 12}
            }.AsQueryable());

            LicenceController ctrl = new LicenceController(mock.Object);
            object[] temp = ctrl.GetLicenceByCreator(person.id);
            Assert.AreEqual(temp.Length, 2);
            Assert.AreEqual(((Licence)temp[1]).inventory_number, "dddd");

            temp = ctrl.GetLicenceByCreator(22);
            Assert.AreEqual(temp.Length, 0);

            temp = ctrl.GetLicencesByLastModifiedPersonId(9);
            Assert.AreEqual(temp.Length, 3);
            Assert.AreEqual(((Licence)temp[1]).inventory_number, "cccc");

            temp = ctrl.GetLicencesByLastModifiedPersonId(33);
            Assert.AreEqual(temp.Length, 0);
        }