public void IslandsQueryAgentShouldReturnReferences() { using (var connection = new FTTConnection()) { var queryAgent = new IslandsQueryAgent(connection); var references = queryAgent.GetReferences(); var countries = references.GetType().GetProperty("Countries").GetValue(references, null) as ICollection<Country>; Assert.IsTrue(countries.Any()); } }
public void RegionsQueryAgentShouldReturnSpecificRecord() { using (var connection = new FTTConnection()) { var persistedRegion = connection.Regions.FirstOrDefault(r => "NCR".Equals(r.Name, StringComparison.InvariantCultureIgnoreCase)); Assert.IsNotNull(persistedRegion); var queryAgent = new RegionsQueryAgent(connection); var retrievedRegion = queryAgent.Get(persistedRegion.RegionId); Assert.IsNotNull(retrievedRegion); } }
public void IslandsQueryAgentShouldReturnSpecificRecord() { using (var connection = new FTTConnection()) { var persistedIsland = connection.Islands.FirstOrDefault(i => "Luzon".Equals(i.Name, StringComparison.InvariantCultureIgnoreCase)); Assert.IsNotNull(persistedIsland); var queryAgent = new IslandsQueryAgent(connection); var retrievedIsland = queryAgent.Get(persistedIsland.IslandId); Assert.IsNotNull(retrievedIsland); } }
public void CountriesQueryAgentShouldReturnSpecificRecord() { using (var connection = new FTTConnection()) { var persistedCountry = connection.Countries.FirstOrDefault(c => "Philippines".Equals(c.Name, StringComparison.InvariantCultureIgnoreCase)); Assert.IsNotNull(persistedCountry); var queryAgent = new CountriesQueryAgent(connection); var retrievedCountry = queryAgent.Get(persistedCountry.CountryId); Assert.IsNotNull(retrievedCountry); } }
public void LocalitiesQueryAgentShouldReturnSpecificRecord() { using (var connection = new FTTConnection()) { var persistedLocality = connection.Localities.FirstOrDefault(l => "Malabon".Equals(l.Name, StringComparison.InvariantCultureIgnoreCase)); Assert.IsNotNull(persistedLocality); var queryAgent = new LocalitiesQueryAgent(connection); var retrievedLocality = queryAgent.Get(persistedLocality.LocalityId); Assert.IsNotNull(retrievedLocality); } }
public void LocalityGroupsQueryAgentShouldReturnSpecificRecord() { using (var connection = new FTTConnection()) { var persistedLocalityGroup = connection.LocalityGroups.FirstOrDefault(lg => "CAMANAVA".Equals(lg.Name, StringComparison.InvariantCultureIgnoreCase)); Assert.IsNotNull(persistedLocalityGroup); var queryAgent = new LocalityGroupsQueryAgent(connection); var retrievedLocalityGroup = queryAgent.Get(persistedLocalityGroup.LocalityGroupId); Assert.IsNotNull(retrievedLocalityGroup); } }
public void CreateDatabaseIfNotExistsAndSeedData() { using (var connection = new FTTConnection()) { var roles = connection.Roles.ToList(); Assert.IsTrue(roles.Any()); var users = connection.ApplicationUsers.ToList(); Assert.IsTrue(users.Any()); var churchKid = connection.ApplicationUsers.FirstOrDefault(u => "churchkid".Equals(u.Username, StringComparison.InvariantCulture)); Assert.IsNotNull(churchKid); Assert.IsTrue(churchKid.IsAdministrator); var moduleGroups = connection.ApplicationModuleGroups.ToList(); Assert.IsTrue(moduleGroups.Any()); var modules = connection.ApplicationModules.ToList(); Assert.IsTrue(modules.Any()); var countries = connection.Countries.ToList(); Assert.IsTrue(countries.Any()); var islands = connection.Islands.ToList(); Assert.IsTrue(islands.Any()); var regions = connection.Regions.ToList(); Assert.IsTrue(regions.Any()); var localityGroups = connection.LocalityGroups.ToList(); Assert.IsTrue(localityGroups.Any()); var localities = connection.Localities.ToList(); Assert.IsTrue(localities.Any()); var clusters = connection.Clusters.ToList(); Assert.IsTrue(clusters.Any()); var districts = connection.Districts.ToList(); Assert.IsTrue(districts.Any()); var educationalLevels = connection.EducationalLevels.ToList(); Assert.IsTrue(educationalLevels.Any()); var trainingCenters = connection.TrainingCenters.ToList(); Assert.IsTrue(trainingCenters.Any()); var trainingLevels = connection.TrainingLevels.ToList(); Assert.IsTrue(trainingLevels.Any()); } }
public void RegionsQueryAgentShouldReturnAllRecords() { using (var connection = new FTTConnection()) { var persistedRegions = connection.Regions.ToList(); Assert.IsTrue(persistedRegions.Any()); var queryAgent = new RegionsQueryAgent(connection); var retrievedRegions = queryAgent.GetAll(); Assert.IsNotNull(retrievedRegions); Assert.IsTrue(retrievedRegions.Any()); Assert.AreEqual(persistedRegions.Count, retrievedRegions.Count); } }
public void RegionsQueryAgentShouldReturnSpecificRecords() { using (var connection = new FTTConnection()) { var persistedRegions = connection.Regions .Where(r => r.Name.StartsWith("Region")) .ToList(); Assert.IsTrue(persistedRegions.Any()); var queryAgent = new RegionsQueryAgent(connection); var retrievedRegions = queryAgent.Get("regions.Name LIKE 'Region%'", "regions.Name"); Assert.IsNotNull(retrievedRegions); Assert.IsTrue(retrievedRegions.Any()); Assert.AreEqual(persistedRegions.Count, retrievedRegions.Count); } }
public void IslandsQueryAgentShouldReturnSpecificRecords() { using (var connection = new FTTConnection()) { var persistedIslands = connection.Islands .Where(i => i.Name.StartsWith("L")) .ToList(); Assert.IsTrue(persistedIslands.Any()); var queryAgent = new IslandsQueryAgent(connection); var retrievedIslands = queryAgent.Get("islands.Name LIKE 'L%'", "islands.Name"); Assert.IsNotNull(retrievedIslands); Assert.IsTrue(retrievedIslands.Any()); Assert.AreEqual(persistedIslands.Count, retrievedIslands.Count); } }
public void LocalitiesQueryAgentShouldReturnSpecificRecords() { using (var connection = new FTTConnection()) { var persistedLocalities = connection.Localities .Where(l => l.Name.StartsWith("M")) .ToList(); Assert.IsTrue(persistedLocalities.Any()); var queryAgent = new LocalitiesQueryAgent(connection); var retrievedLocalities = queryAgent.Get("localities.Name LIKE 'M%'", "localities.Name"); Assert.IsNotNull(retrievedLocalities); Assert.IsTrue(retrievedLocalities.Any()); Assert.AreEqual(persistedLocalities.Count, retrievedLocalities.Count); } }
public void LocalityGroupsQueryAgentShouldReturnReferences() { using (var connection = new FTTConnection()) { var queryAgent = new LocalityGroupsQueryAgent(connection); var references = queryAgent.GetReferences(); var countries = references.GetType().GetProperty("Countries").GetValue(references, null) as ICollection<Country>; Assert.IsTrue(countries.Any()); var islands = references.GetType().GetProperty("Islands").GetValue(references, null) as ICollection<Island>; Assert.IsTrue(islands.Any()); var regions = references.GetType().GetProperty("Regions").GetValue(references, null) as ICollection<Region>; Assert.IsTrue(regions.Any()); } }
public void CountriesQueryAgentShouldReturnSpecificRecordsUsingParameters() { using (var connection = new FTTConnection()) { var persistedCountries = connection.Countries .Where(c => c.Name.StartsWith("P")) .ToList(); Assert.IsTrue(persistedCountries.Any()); var queryAgent = new CountriesQueryAgent(connection); var retrievedCountries = queryAgent.Get("Name LIKE @NameFilter", new MySqlParameter("@NameFilter", "P%")); Assert.IsNotNull(retrievedCountries); Assert.IsTrue(retrievedCountries.Any()); Assert.AreEqual(persistedCountries.Count, retrievedCountries.Count); } }
public TrainingCenters(FTTConnection connection) { this.connection = connection; SeedData = Properties.Resources.TrainingCenters; }
public void LocalityGroupsQueryAgentShouldReturnSpecificRecordsUsingParameters() { using (var connection = new FTTConnection()) { var persistedLocalityGroups = connection.LocalityGroups .Where(lg => lg.Name.StartsWith("C")) .ToList(); Assert.IsTrue(persistedLocalityGroups.Any()); var queryAgent = new LocalityGroupsQueryAgent(connection); var retrievedLocalityGroups = queryAgent.Get("localitygroups.Name LIKE @NameFilter", new MySqlParameter("@NameFilter", "C%")); Assert.IsNotNull(retrievedLocalityGroups); Assert.IsTrue(retrievedLocalityGroups.Any()); Assert.AreEqual(persistedLocalityGroups.Count, retrievedLocalityGroups.Count); } }