public void Dispose()
        {
            if (_client != null)
            {
                IEnumerable<dynamic> products = _client.FindEntries("Products");
                foreach (var product in products)
                {
                    if (product["ProductName"].ToString().StartsWith("Test"))
                        _client.DeleteEntry("Products", product);
                }
                IEnumerable<dynamic> categories = _client.FindEntries("Categories");
                foreach (var category in categories)
                {
                    if (category["CategoryName"].ToString().StartsWith("Test"))
                        _client.DeleteEntry("Categories", category);
                }
                IEnumerable<dynamic> transports = _client.FindEntries("Transport");
                foreach (var transport in transports)
                {
                    if (int.Parse(transport["TransportID"].ToString()) > 2)
                        _client.DeleteEntry("Transport", transport);
                }
            }

#if NETFX_CORE
#else
            if (_service != null)
            {
                _service.Dispose();
                _service = null;
            }
#endif
        }
        public TestBase()
        {
#if NETFX_CORE
            _serviceUri = "http://NORTHWIND/Northwind/Northwind.svc/";
#else
            _service = new TestService(typeof(NorthwindService));
            _serviceUri = _service.ServiceUri.AbsoluteUri;
#endif
            _client = CreateClientWithDefaultSettings();
        }
Esempio n. 3
0
        public void Dispose()
        {
            IEnumerable<dynamic> products = _db.Products.FindAll(_db.Products.ProductName.StartsWith("Test") == true);
            products.ToList().ForEach(x => _db.Products.Delete(ProductID: x.ProductID));
            IEnumerable<dynamic> categories = _db.Categories.FindAll(_db.Categories.CategoryName.StartsWith("Test") == true);
            categories.ToList().ForEach(x => _db.Categories.Delete(CategoryID: x.CategoryID));

            if (_service != null)
            {
                _service.Dispose();
                _service = null;
            }
        }
Esempio n. 4
0
        public void Dispose()
        {
            IEnumerable<dynamic> products = _client.FindEntries("Products");
            products.ToList().ForEach(x =>
                {
                    if (x["ProductName"].ToString().StartsWith("Test")) _client.DeleteEntry("Products", x);
                });
            IEnumerable<dynamic> categories = _client.FindEntries("Categories");
            categories.ToList().ForEach(x =>
            {
                if (x["CategoryName"].ToString().StartsWith("Test")) _client.DeleteEntry("Categories", x);
            });

            if (_service != null)
            {
                _service.Dispose();
                _service = null;
            }
        }
Esempio n. 5
0
 public TestBase()
 {
     _service = new TestService(typeof(NorthwindService));
     _db = Database.Opener.Open(_service.ServiceUri);
     Database.SetPluralizer(new EntityPluralizer());
 }
Esempio n. 6
0
 public TestBase()
 {
     _service = new TestService(typeof(NorthwindService));
     _client = new ODataClient(_service.ServiceUri.AbsoluteUri);
 }