GetRepositoryById() 공개 메소드

Method to get the repository by id.
public GetRepositoryById ( int repositoryId ) : Microsoft.Research.DataOnboarding.DomainModel.Repository
repositoryId int Repository id.
리턴 Microsoft.Research.DataOnboarding.DomainModel.Repository
        public void Update_Repository_Test()
        {
            IRepositoryDetails repository = new RepositoryDetails(testDBContext);

            var selRep = repository.GetRepositoryById(1);

            // Updating data
            selRep.AllowedFileTypes = "Updated FileTypes";
            selRep.HttpDeleteUriTemplate = "Updated HttpDeleteUriTemplate";
            selRep.HttpGetUriTemplate = "Updated HttpGetUriTemplate";
            selRep.HttpIdentifierUriTemplate = "Updated HttpIdentifierUriTemplate";
            selRep.HttpPostUriTemplate = "Updated HttpPostUriTemplate";
            selRep.ImpersonatingPassword = "******";
            selRep.ImpersonatingUserName = "******";
            selRep.IsImpersonating = true;
            selRep.IsVisibleToAll = false;
            selRep.Name = "Updated Name";
            selRep.UserAgreement = "Updated UserAgreement";

            repository.UpdateRepository(selRep);

            testDBContext.Commit();

            var updatedRep = repository.GetRepositoryById(1);

            Assert.IsNotNull(updatedRep);

            Assert.AreEqual(updatedRep.AllowedFileTypes, "Updated FileTypes");
            Assert.AreEqual(updatedRep.HttpDeleteUriTemplate, "Updated HttpDeleteUriTemplate");
            Assert.AreEqual(updatedRep.HttpGetUriTemplate, "Updated HttpGetUriTemplate");
            Assert.AreEqual(updatedRep.HttpIdentifierUriTemplate, "Updated HttpIdentifierUriTemplate");
            Assert.AreEqual(updatedRep.HttpPostUriTemplate, "Updated HttpPostUriTemplate");
            Assert.AreEqual(updatedRep.ImpersonatingPassword, "Updated ImpersonatingPassword");
            Assert.AreEqual(updatedRep.ImpersonatingUserName, "Updated ImpersonatingUserName");
            Assert.AreEqual(updatedRep.Name, "Updated Name");
            Assert.AreEqual(updatedRep.UserAgreement, "Updated UserAgreement");

            Assert.IsTrue((bool)updatedRep.IsImpersonating);
            Assert.IsFalse(updatedRep.IsVisibleToAll);
        }
        public void Get_Repository_By_ID_Test()
        {
            IRepositoryDetails repository = new RepositoryDetails(testDBContext);

            var selRep = repository.GetRepositoryById(1);

            Assert.IsNotNull(selRep);

            Assert.AreEqual(selRep.AllowedFileTypes, "xlsx,nc,csv");
            Assert.AreEqual(selRep.HttpDeleteUriTemplate, "http://google.com");
            Assert.AreEqual(selRep.HttpGetUriTemplate, "http://google.com");
            Assert.AreEqual(selRep.HttpIdentifierUriTemplate, "http://google.com");
            Assert.AreEqual(selRep.HttpPostUriTemplate, "http://google.com");
            Assert.AreEqual(selRep.ImpersonatingPassword, "pwd");
            Assert.AreEqual(selRep.ImpersonatingUserName, "user1");
            Assert.AreEqual(selRep.ModifiedBy, 1);
            Assert.AreEqual(selRep.CreatedBy, 1);
            Assert.AreEqual(selRep.Name, "Repository1");
            Assert.AreEqual(selRep.RepositoryId, 1);
            Assert.AreEqual(selRep.UserAgreement, "Test Agreement1");
            Assert.AreEqual(selRep.BaseRepositoryId, 1);

            Assert.IsTrue((bool)selRep.IsActive);
            Assert.IsTrue((bool)selRep.IsImpersonating);
            Assert.IsTrue(selRep.IsVisibleToAll);

        }
        public void Add_Repository_Test()
        {
            IRepositoryDetails repository = new RepositoryDetails(testDBContext);

            Repository repositoryObject = new Repository()
            {
                AllowedFileTypes = "xlsx,nc,csv",
                CreatedBy = 1,
                // Files = null,
                CreatedOn = DateTime.Now,
                HttpDeleteUriTemplate = "http://google.com",
                HttpGetUriTemplate = "http://google.com",
                HttpIdentifierUriTemplate = "http://google.com",
                HttpPostUriTemplate = "http://google.com",
                ImpersonatingPassword = "******",
                ImpersonatingUserName = "******",
                IsActive = true,
                IsImpersonating = true,
                ModifiedBy = 1,
                ModifiedOn = DateTime.Now,
                Name = "AddedRepository",
                RepositoryId = 3,
                UserAgreement = "Test Agreement Added",
                BaseRepositoryId = 1
            };

            AddRepository(repositoryObject);

            var addedRepository = repository.GetRepositoryById(3);

            Assert.AreEqual(addedRepository.AllowedFileTypes, repositoryObject.AllowedFileTypes);

            Assert.AreEqual(addedRepository.CreatedBy, repositoryObject.CreatedBy);

            Assert.AreEqual(addedRepository.CreatedOn, repositoryObject.CreatedOn);

            Assert.AreEqual(addedRepository.HttpDeleteUriTemplate, repositoryObject.HttpDeleteUriTemplate);

            Assert.AreEqual(addedRepository.HttpGetUriTemplate, repositoryObject.HttpGetUriTemplate);

            Assert.AreEqual(addedRepository.HttpIdentifierUriTemplate, repositoryObject.HttpIdentifierUriTemplate);

            Assert.AreEqual(addedRepository.HttpPostUriTemplate, repositoryObject.HttpPostUriTemplate);

            Assert.AreEqual(addedRepository.ImpersonatingPassword, repositoryObject.ImpersonatingPassword);

            Assert.AreEqual(addedRepository.ImpersonatingUserName, repositoryObject.ImpersonatingUserName);

            Assert.AreEqual(addedRepository.IsActive, repositoryObject.IsActive);

            Assert.AreEqual(addedRepository.IsImpersonating, repositoryObject.IsImpersonating);

            Assert.AreEqual(addedRepository.ModifiedBy, repositoryObject.ModifiedBy);

            Assert.AreEqual(addedRepository.ModifiedOn, repositoryObject.ModifiedOn);

            Assert.AreEqual(addedRepository.Name, repositoryObject.Name);

            Assert.AreEqual(addedRepository.RepositoryId, repositoryObject.RepositoryId);

            Assert.AreEqual(addedRepository.UserAgreement, repositoryObject.UserAgreement);
        }
        public void Get_Repository_By_ID_Empty_Test()
        {
            IRepositoryDetails repository = new RepositoryDetails(testDBContext);

            var selRep = repository.GetRepositoryById(5);

            Assert.IsNull(selRep);
        }