Exemplo n.º 1
0
        public async Task Update()
        {
            IStationTypeDao stationTypeDao =
                new AdoStationTypeDao(DefaultConnectionFactory.FromConfiguration(_connectionStringConfigName));

            StationType stationType = await stationTypeDao.FindByIdAsync(1);

            string manufacturer = stationType.Manufacturer;

            stationType.Manufacturer = "Test";
            bool update1 = await stationTypeDao.UpdateAllAsync(stationType);

            Assert.IsTrue(update1);

            StationType stationType1 = await stationTypeDao.FindByIdAsync(1);

            Assert.IsTrue(stationType1.Manufacturer == "Test");

            stationType.Manufacturer = manufacturer;
            bool update2 = await stationTypeDao.UpdateAllAsync(stationType);

            Assert.IsTrue(update2);

            StationType stationType2 = await stationTypeDao.FindByIdAsync(1);

            Assert.IsTrue(stationType2.Manufacturer == manufacturer);
        }
Exemplo n.º 2
0
        public async Task FindById()
        {
            IStationTypeDao stationTypeDao =
                new AdoStationTypeDao(DefaultConnectionFactory.FromConfiguration(_connectionStringConfigName));

            StationType stationType = await stationTypeDao.FindByIdAsync(1);

            Assert.IsTrue(stationType != null && stationType.Id == 1);
        }
Exemplo n.º 3
0
        public async Task FindByManufacturer()
        {
            IStationTypeDao stationTypeDao =
                new AdoStationTypeDao(DefaultConnectionFactory.FromConfiguration(_connectionStringConfigName));

            IEnumerable <StationType> stationTypes = await stationTypeDao.FindByManufacturerAsync("SKEY");

            StationType stationType = stationTypes.FirstOrDefault();

            Assert.IsTrue(stationType != null && stationType.Id == 1);
        }
Exemplo n.º 4
0
        public async Task FindAll()
        {
            IStationTypeDao stationTypeDao =
                new AdoStationTypeDao(DefaultConnectionFactory.FromConfiguration(_connectionStringConfigName));

            IEnumerable <StationType> stationTypes = await stationTypeDao.FindAllAsync();

            int count = stationTypes.Count();

            Assert.IsTrue(count > 1);
        }
Exemplo n.º 5
0
        public async Task Add()
        {
            IStationTypeDao stationTypeDao =
                new AdoStationTypeDao(DefaultConnectionFactory.FromConfiguration(_connectionStringConfigName));

            StationType stationType = new StationType("Test", "Test");

            bool insert = await stationTypeDao.AddStationTypeAsync(stationType);

            Assert.IsTrue(insert);

            StationType stationType1 =
                (await stationTypeDao.FindByManufacturerModelAsync(stationType.Manufacturer, stationType.Model)).FirstOrDefault();

            Assert.IsTrue(stationType1 != null && stationType1.Model == stationType.Model);

            bool delete = await stationTypeDao.DeleteStationTypeAsync(stationType1);

            Assert.IsTrue(delete);
        }