Пример #1
0
        public void AddPackageTest()
        {
            //Arrange
            setUp();
            PackageService s    = new PackageService();
            var            name = "adifjfej23";

            //Act
            var Repository = new DocuRepository(MockContext);
            int p          = s.AddPackage(name);

            //Assert
            Assert.AreEqual(name, Repository.GetPackageByID(p).Name);
            Assert.AreEqual(Repository.GetPDs().Count(), 0);

            IEnumerable <Package> result = Repository.GetPackages();

            Assert.AreEqual(result.Count(), 1);
        }
Пример #2
0
        public void AddDocumentsToPackagesTest()
        {
            //Arrange
            setUp();
            PackageService s = new PackageService();

            //Act
            var Repository = new DocuRepository(MockContext);
            int p          = s.AddPackage("foo");
            int p2         = s.AddPackage("bar");

            s.AddDocumentToPackage(Repository.GetDocumentByName("Test Document").DocumentID, p);
            s.AddDocumentToPackage(Repository.GetDocumentByName("Test Document 2").DocumentID, p);
            s.AddDocumentToPackage(Repository.GetDocumentByName("Test Document 2").DocumentID, p2);

            //Assert
            Assert.AreEqual(Repository.GetPDs().Count(), 3);
            Assert.AreEqual(Repository.GetPDsByDocName("Test Document").Count(), 1);
            Assert.AreEqual(Repository.GetPDsByDocName("Test Document 2").Count(), 2);
            Assert.AreEqual(Repository.GetPDsByDocName("foo").Count(), 2);
            Assert.AreEqual(Repository.GetPDsByDocName("bar").Count(), 1);
        }