Exemplo n.º 1
0
        public async Task Update()
        {
            IStationDao stationDao =
                new AdoStationDao(DefaultConnectionFactory.FromConfiguration(_connectionStringConfigName));

            Station station = await stationDao.FindByIdAsync(1);

            string name = station.Name;

            station.Name = "TEST UPDATE";
            bool update1 = await stationDao.UpdateAllAsync(station);

            Assert.IsTrue(update1);

            Station station1 = await stationDao.FindByIdAsync(1);

            Assert.IsTrue(station1.Name == "TEST UPDATE");

            station.Name = name;
            bool update2 = await stationDao.UpdateAllAsync(station);

            Assert.IsTrue(update2);

            Station station2 = await stationDao.FindByIdAsync(1);

            Assert.IsTrue(station2.Name == name);
        }
Exemplo n.º 2
0
        public async Task FindByProvinceId()
        {
            IStationDao stationDao =
                new AdoStationDao(DefaultConnectionFactory.FromConfiguration(_connectionStringConfigName));

            Station station = (await stationDao.FindByProvinceIdAsync(1)).FirstOrDefault();

            Assert.IsTrue(station != null && station.CommunityId == 85);
        }
Exemplo n.º 3
0
        public async Task FindByName()
        {
            IStationDao stationDao =
                new AdoStationDao(DefaultConnectionFactory.FromConfiguration(_connectionStringConfigName));

            Station station = (await stationDao.FindByNameAsync("ANDAU")).FirstOrDefault();

            Assert.IsTrue(station != null && station.Name == "ANDAU");
        }
Exemplo n.º 4
0
        public async Task FindByJoinedId()
        {
            IStationDao stationDao =
                new AdoStationDao(DefaultConnectionFactory.FromConfiguration(_connectionStringConfigName));

            Station station = await stationDao.FindJoinedByIdAsync(1);

            Assert.IsTrue(station != null && station.Id == 1);
        }
Exemplo n.º 5
0
        public async Task FindAll()
        {
            IStationDao stationDao =
                new AdoStationDao(DefaultConnectionFactory.FromConfiguration(_connectionStringConfigName));

            IEnumerable <Station> stations = await stationDao.FindAllAsync();

            int count = stations.Count();

            Assert.IsTrue(count > 1);
        }
Exemplo n.º 6
0
        public async Task FindByCreator()
        {
            IStationDao stationDao =
                new AdoStationDao(DefaultConnectionFactory.FromConfiguration(_connectionStringConfigName));

            IEnumerable <Station> stations = await stationDao.FindByCreatorIdAsync(1);

            Assert.IsTrue(stations.Any());

            IEnumerable <Station> stations2 = await stationDao.FindByCreatorIdAsync(1231234123);

            Assert.IsFalse(stations2.Any());
        }
Exemplo n.º 7
0
        public async Task Add()
        {
            IStationDao stationDao =
                new AdoStationDao(DefaultConnectionFactory.FromConfiguration(_connectionStringConfigName));

            Station station = new Station("Test!!", 1, 42.111, 42.111, 85, 122.4, 1);
            bool    insert1 = await stationDao.AddStationAsync(station);

            Assert.IsTrue(insert1);

            Station station1 = (await stationDao.FindByNameAsync("Test!!")).FirstOrDefault();

            Assert.IsTrue(station1 != null && station1.Name == station.Name);

            bool delete = await stationDao.DeleteStationAsync(station1);

            Assert.IsTrue(delete);
        }