Beispiel #1
0
        public async Task Get_All_Continents()
        {
            //Arrange
            conQueries = new ContinentQueries(context.Object);

            //Act
            var cqContitnents = await conQueries.GetAllContinentsAsync();

            //Assert
            Assert.AreEqual(continents.Count, cqContitnents.Count);
        }
Beispiel #2
0
        public async Task Continent_Not_Found()
        {
            //Arrange
            string continentName = "Sheep";

            conQueries = new ContinentQueries(context.Object);

            //Act
            var result = await conQueries.GetContinentAsync(continentName);

            //Assert
            Assert.IsNull(result);
        }
Beispiel #3
0
        public async Task Get_Continent_By_Name()
        {
            //Arrange
            string continentName = "Lion";

            conQueries = new ContinentQueries(context.Object);

            //Act
            var result = await conQueries.GetContinentAsync(continentName);

            var cont = continents.Where(w => w.Name == continentName).FirstOrDefault();

            //Assert
            Assert.AreEqual(cont.ContinentId, result.ContinentId);
            Assert.AreEqual(cont.Name, result.Name);
            Assert.AreEqual(cont.ContinentCode, result.ContinentCode);
        }
Beispiel #4
0
        public async Task Get_Continent_And_Countries()
        {
            //Arrange
            int continentId = 2;
            var single      = continents.Where(w => w.ContinentId == continentId).FirstOrDefault();

            single.Countries.Add(countries[0]);
            single.Countries.Add(countries[1]);
            single.Countries.Add(countries[2]);

            conQueries = new ContinentQueries(context.Object);

            //Act
            var result = await conQueries.GetContinentAsync(continentId);

            var cont = continents.Where(w => w.ContinentId == continentId).FirstOrDefault();

            //Assert
            Assert.AreEqual(cont.ContinentId, result.ContinentId);
            Assert.AreEqual(cont.Name, result.Name);
            Assert.AreEqual(cont.ContinentCode, result.ContinentCode);
            Assert.IsTrue(result.Countries.Count == 3);
        }
Beispiel #5
0
 public ContinentsController(DbContext context)
 {
     //this.db = context as GlobalStandardsEntities;
     //db.Configuration.LazyLoadingEnabled = false;
     cq = new ContinentQueries(context);
 }