Esempio n. 1
0
        public void ValidAll_Commit_Test()
        {
            // Assign
            ITmxContext context = new TmxContext(MockObjects.VALID_TestFilesPath);
            bool        pass    = context.Add(MockObjects.VALID_en_Add_ContextTmxFile);

            Assert.IsTrue(pass, "Context Add method is broken");
            TmxFile update = (from tmx in context.Get("en")
                              where tmx.FileInfo.FullName == MockObjects.VALID_Update_TmxFilePath.FullName
                              select tmx).First <TmxFile>();

            pass = context.Update(update);
            Assert.IsTrue(pass, "Context Update method is broken");
            TmxFile delete = (from tmx in context.Get("en")
                              where tmx.FileInfo.FullName == MockObjects.VALID_Delete_TmxFilePath.FullName
                              select tmx).First <TmxFile>();

            pass = context.Update(delete);
            Assert.IsTrue(pass, "Context Update method is broken");

            // Act
            int result = context.SaveChanges();

            // Assert
            Assert.AreEqual(3, result);
            Assert.IsTrue(File.Exists(MockObjects.VALID_en_Add_ContextTmxFilePath.FullName));
            Assert.IsTrue(File.Exists(MockObjects.VALID_Delete_TmxFilePath.FullName));
        }
Esempio n. 2
0
        public void TmxContext_Constructor_Test()
        {
            // Act
            ITmxContext context = new TmxContext(MockObjects.VALID_LanguageRepositoryPath);

            // Assert
            Assert.AreEqual(MockObjects.VALID_LanguageRepositoryPath, context.Root);
        }
Esempio n. 3
0
        public void ValidEmptyHistory_Commit_Test()
        {
            // Assign
            ITmxContext context = new TmxContext(MockObjects.VALID_LanguageRepositoryPath);

            // Act
            int result = context.SaveChanges();

            // Assert
            Assert.AreEqual(0, result);
        }
Esempio n. 4
0
        public void ValidNoChanges_Commit_Test()
        {
            // Assign
            ITmxContext    context = new TmxContext(MockObjects.VALID_LanguageRepositoryPath);
            List <TmxFile> files   = context.Get("en");

            // Act
            int result = context.SaveChanges();

            // Assert
            Assert.AreEqual(0, result);
        }
Esempio n. 5
0
        public void ValidAdd_Commit_Test()
        {
            // Assign
            ITmxContext context = new TmxContext(MockObjects.VALID_TestFilesPath);
            bool        pass    = context.Add(MockObjects.VALID_en_Add_ContextTmxFile);

            Assert.IsTrue(pass, "Context Add method is broken");

            // Act
            int result = context.SaveChanges();

            // Assert
            Assert.AreEqual(1, result);
            Assert.IsTrue(File.Exists(MockObjects.VALID_en_Add_ContextTmxFilePath.FullName));
        }
Esempio n. 6
0
        public void Valid_Add_Test()
        {
            // Assign
            ITmxContext context = new TmxContext(MockObjects.VALID_LanguageRepositoryPath);
            int         count   = context.Get("en").Count;

            // Act
            bool result = context.Add(MockObjects.VALID_en_Add_ContextTmxFile);

            // Assert
            Assert.IsTrue(result);
            List <TmxFile> items = context.Get("en");

            Assert.AreEqual(count + 1, items.Count);
        }
Esempio n. 7
0
        public void NewLanguageCode_Add_Test()
        {
            // Assign
            ITmxContext context = new TmxContext(MockObjects.VALID_LanguageRepositoryPath);
            int         count   = context.Get("la").Count;
            TmxFile     addFile = MockObjects.NewLanguageCode_la_Add_ContextTmxFile;

            // Act
            bool result = context.Add(addFile);

            // Assert
            Assert.IsTrue(result);
            List <TmxFile> items = context.Get("la");

            Assert.AreEqual(count + 1, items.Count);
            Assert.AreEqual(MockObjects.NewLanguageCode_la_Add_ContextTmxFilePath_Result.FullName, addFile.FileInfo.FullName);
        }