예제 #1
0
        public void Should_CreateFolder()
        {
            var model = TestFactory.Create <ModelFolder>();
            var res   = _repo.Create(model);

            Assert.False(res.HasError);

            var resAll = _repo.All;
            var list   = resAll.Value;

            Assert.False(resAll.HasError);
            Assert.Single(list);

            Assert.True(list [0].Equals(model));
        }
예제 #2
0
        public void ApplyDifferenceCreateFile()
        {
            string           fileToAdd        = "Bhanu.txt";
            DbRepository     dbRepository     = new DbRepository("DbFolder");
            FolderRepository uploadRepository = new FolderRepository(
                $@"{Utils.GetSetupDir()}\UploadFolder");

            uploadRepository.Create("Folder1", fileToAdd, false);
            List <Storage> output  = Utils.Compare(dbRepository, uploadRepository, "Folder1");
            Storage        storage = output[0];

            dbRepository.ApplyChanges(
                "Folder1",
                output);
            List <Storage> dbStorageList = dbRepository.PopulateStorageList(
                "Folder1");
            bool isFound = false;

            foreach (Storage myStorage in dbStorageList)
            {
                if (myStorage.Name == fileToAdd)
                {
                    Assert.AreEqual(false, myStorage.IsFolder, "Incorrect type");
                    isFound = true;
                }
            }
            Assert.IsTrue(isFound, $"{fileToAdd} cannot be found in the db");
        }
예제 #3
0
        public void ApplyDifferenceCreateFolderTopFolder()
        {
            string           folderToAdd      = "Nagesh";
            DbRepository     dbRepository     = new DbRepository("DbFolder");
            FolderRepository uploadRepository = new FolderRepository(
                $@"{Utils.GetSetupDir()}\UploadFolder");

            uploadRepository.Create("", folderToAdd, true);
            List <Storage> output  = Utils.Compare(dbRepository, uploadRepository, "");
            Storage        storage = output[0];

            dbRepository.ApplyChanges(
                "",
                output);
            List <Storage> dbStorageList = dbRepository.PopulateStorageList(
                "");
            bool isFound = false;

            foreach (Storage myStorage in dbStorageList)
            {
                if (myStorage.Name == folderToAdd)
                {
                    isFound = true;
                    break;
                }
            }
            if (!isFound)
            {
                Assert.Fail($"{folderToAdd} was supposed to be present but not found");
            }
        }
예제 #4
0
        public void ShowDifferencecreateFolder()
        {
            DbRepository     dbRepository     = new DbRepository("DbFolder");
            FolderRepository uploadRepository = new FolderRepository($@"{Utils.GetSetupDir()}\UploadFolder");

            uploadRepository.Create("Folder1", "XXX", true);
            List <Storage> output  = Utils.Compare(dbRepository, uploadRepository, "Folder1");
            Storage        storage = output[0];

            Assert.AreEqual(true, storage.IsFolder, "Incorrect type");
            Assert.AreEqual("XXX", storage.Name, "Incorrect Name");
            Assert.AreEqual(Constants.Action.Create, storage.Action, "Incorrect Action");
        }
예제 #5
0
        public void CreateCorrectlyAddedFolder()
        {
            const long   parentId       = 1;
            const long   projectId      = 1;
            const string name           = "NewFolderTest";
            const int    expectedLength = folderCount + 1;

            var repo = new FolderRepository(_context);

            repo.Create(name, parentId, projectId);
            var res = repo.GetAll();

            Assert.Equal(expectedLength, res.Count());
        }