public void Delete_Valid_TmxFile_Test() { // Assign AbstractLanguageRepository repository = new LanguageRepository(); // Act Assert.IsTrue(File.Exists(MockObjects.VALID_Delete_TmxFilePath.FullName)); bool result = repository.Delete(MockObjects.VALID_Delete_TmxFile); // Assert Assert.IsTrue(result); Assert.IsFalse(File.Exists(MockObjects.VALID_Delete_TmxFilePath.FullName)); }
public void Add_Invalid_TmxFile_Test() { // Assign AbstractLanguageRepository repository = new LanguageRepository(); // Act Assert.IsFalse(File.Exists(MockObjects.INVALID_Add_TmxFilePath.FullName)); bool result = repository.Add(MockObjects.INVALID_Add_TmxFile); // Assert Assert.IsFalse(result); Assert.IsFalse(File.Exists(MockObjects.INVALID_Add_TmxFilePath.FullName)); }
public void Get_Valid_TmxFiles_By_Invalid_LanguageCode_Test() { // Assign AbstractLanguageRepository repository = new LanguageRepository(); // Act List<TmxFile> result = repository.Get(MockObjects.VALID_LanguageRepositoryPath, "la"); // Assert Assert.AreEqual(0, result.Count); }
public void Update_Valid_TmxFile_Test() { // Assign AbstractLanguageRepository repository = new LanguageRepository(); TmxFile current = (from tmx in repository.Get(MockObjects.VALID_TestFilesPath) where tmx.FileInfo.FullName == MockObjects.VALID_Update_TmxFilePath.FullName select tmx).First<TmxFile>(); // Act bool result = repository.Update(MockObjects.VALID_Update_TmxFile); // Assert Assert.IsTrue(result); TmxFile updated = (from tmx in repository.Get(MockObjects.VALID_TestFilesPath) where tmx.FileInfo.FullName == MockObjects.VALID_Update_TmxFilePath.FullName select tmx).First<TmxFile>(); Assert.AreNotEqual(current, updated); Assert.AreNotEqual(current.Data.Body.TranslationUnits.Count, updated.Data.Body.TranslationUnits.Count); }
public void Update_NonExist_TmxFile_Test() { // Assign AbstractLanguageRepository repository = new LanguageRepository(); // Act bool result = repository.Update(MockObjects.NonEXIST_Add_TmxFile); // Assert Assert.IsFalse(result); }
public void Get_Valid_TmxFiles_By_Valid_LanguageCode_Test() { // Assign AbstractLanguageRepository repository = new LanguageRepository(); // Act List<TmxFile> result = repository.Get(MockObjects.VALID_LanguageRepositoryPath, "en"); // Assert Assert.AreEqual(2, result.Count); foreach (TmxFile file in result) { Assert.AreEqual("en", file.LanguageCode); } }