public void ShouldReadAllLocales() { // Arrange LocalizationRepository repository = new LocalizationRepository(ConfigSettings.LocalizationDatabaseConnectionName); LocalizationCollectionEntity localizationCollection = LocalizationDataProvider.PreInsertArrange(repository); LocalizationCollectionEntity entityToInsert = LocalizationDataProvider.GetLocalizationCollectionToCreate(); repository.Create(entityToInsert, false); // Act List<LocalizationCollectionEntity> locales = repository.Read(); // Assert Assert.IsNotNull(locales); Assert.AreEqual(2, locales.Count()); }
public static void CreateLanguageFiles(LocalizationRepository repository, string filePath) { FileUtilities.AssertDirectoryExists(filePath); repository.ClearCollection(); string[] fileNames = Directory.GetFiles(filePath); for (int i = 0; i < fileNames.Length; i++) { FileUtilities.AssertFileExists(fileNames[i]); LocalizationCollectionEntity locale = SerializationUtilities.ReadFile<LocalizationCollectionEntity>(fileNames[i]); repository.Create(locale, false, true); } }
public void ShouldCreateLocale() { // Arrange LocalizationRepository repository = new LocalizationRepository(ConfigSettings.LocalizationDatabaseConnectionName); LocalizationDataProvider.PreInsertArrange(repository); LocalizationCollectionEntity entityToInsert = LocalizationDataProvider.GetLocalizationCollectionToCreate(); // Act repository.Create(entityToInsert); // Assert LocalizationCollectionEntity entityToAssert = repository.Read(entityToInsert.Locale); Assert.IsNotNull(entityToAssert); Assert.AreEqual(entityToAssert.Locale, entityToInsert.Locale); }