Пример #1
0
        public void InvalidPath_Add_Test()
        {
            // Assign
            ITmxContext context = new TmxContext(MockObjects.VALID_LanguageRepositoryPath);
            int count = context.Get("en").Count;
            TmxFile addFile = MockObjects.InvalidPath_en_Add_ContextTmxFile;

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

            // Assert
            Assert.IsTrue(result);
            List<TmxFile> items = context.Get("en");
            Assert.AreEqual(count + 1, items.Count);
            Assert.AreEqual(MockObjects.InvalidPath_en_Add_ContextTmxFilePath_Result.FullName, addFile.FileInfo.FullName);
        }
Пример #2
0
        public void ValidUpdate_Commit_Test()
        {
            // Assign
            ITmxContext context = new TmxContext(MockObjects.VALID_TestFilesPath);
            TmxFile update = (from tmx in context.Get("en")
                               where tmx.FileInfo.FullName == MockObjects.VALID_Update_TmxFilePath.FullName
                               select tmx).First<TmxFile>();
            bool pass = context.Update(update);
            Assert.IsTrue(pass, "Context Update method is broken");

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

            // Assert
            Assert.AreEqual(1, result);
        }
Пример #3
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);
        }
Пример #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);
        }