コード例 #1
0
        public void TestDeleteNotInUse()
        {
            Country country = _dataGenerator.CreateCountry();

            ICountryDao countryDao = new CountryDao(_graphClient);

            countryDao.Delete(country);

            Assert.AreEqual(0, countryDao.GetAll().Count);
        }
コード例 #2
0
        public void TestDeleteInUse()
        {
            Country country = _dataGenerator.CreateCountry();
            Route   route   = _dataGenerator.CreateRouteInCountry(country: country);

            ICountryDao countryDao = new CountryDao(_graphClient);
            Action      action     = () => countryDao.Delete(country);

            action.ShouldThrow <NodeInUseException>();
        }
コード例 #3
0
        public async void TestDelete()
        {
            ConnectionFactory connectionFactory = new ConnectionFactory(Environment.Testing);
            ICountryDao       countryDao        = new CountryDao(connectionFactory);

            Country country = new Country {
                Code = "AT"
            };

            country.Id = await countryDao.Insert(country);

            Assert.NotNull(await countryDao.FindById(country.Id));

            await countryDao.Delete(country.Id);

            Assert.Null(await countryDao.FindById(country.Id));
        }