Ejemplo n.º 1
0
        public void ApplyDifferenceCreateFile()
        {
            string           fileToAdd        = "Bhanu.txt";
            FolderRepository dbRepository     = new FolderRepository($@"{Utils.GetSetupDir()}\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");
        }
Ejemplo n.º 2
0
        public void ApplyDifferenceDeleteFileTopFolder()
        {
            //ApplyDifferenceCreateFileTopFolder();
            string           fileToDelete     = "File1.txt";
            FolderRepository dbRepository     = new FolderRepository($@"{Utils.GetSetupDir()}\DbFolder");
            FolderRepository uploadRepository = new FolderRepository(
                $@"{Utils.GetSetupDir()}\UploadFolder");

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

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

            foreach (Storage myStorage in dbStorageList)
            {
                if (myStorage.Name == fileToDelete)
                {
                    Assert.Fail($"The file {fileToDelete} should be deleted but it is still present");
                }
            }
        }
Ejemplo n.º 3
0
        public void ApplyDifferenceDeleteFolderTopFolder()
        {
            ApplyDifferenceCreateFolderTopFolder();
            string           folderToDelete   = "Nagesh";
            FolderRepository dbRepository     = new FolderRepository($@"{Utils.GetSetupDir()}\DbFolder");
            FolderRepository uploadRepository = new FolderRepository(
                $@"{Utils.GetSetupDir()}\UploadFolder");

            uploadRepository.Delete($@"{folderToDelete}", true);
            List <Storage> output  = Utils.Compare(dbRepository, uploadRepository, "");
            Storage        storage = output[0];

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

            foreach (Storage myStorage in dbStorageList)
            {
                if (myStorage.Name == folderToDelete)
                {
                    Assert.Fail($"{folderToDelete} should not show up as it should be deleted");
                }
            }
        }
Ejemplo n.º 4
0
        public void ApplyDifferenceCreateFolderTopFolder()
        {
            string           folderToAdd      = "Nagesh";
            FolderRepository dbRepository     = new FolderRepository($@"{Utils.GetSetupDir()}\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");
            }
        }