Beispiel #1
0
        public virtual IODataRepository <T> GetGenericRepository <T>() where T : BaseEntityType
        {
            if (this._genericRepositories.ContainsKey(typeof(T)))
            {
                return(this._genericRepositories[typeof(T)] as IODataRepository <T>);
            }

            ODataRepository <T, C> repository = new ODataRepository <T, C>(this.Context);

            this._genericRepositories[typeof(T)] = repository;

            return(repository);
        }
        public void Should_Return_Product_Inserted()
        {
            var repository = new ODataRepository();

            repository.ProductList = null;

            var product = new Product()
            {
                Name  = "Ball",
                Price = 100
            };

            repository.Insert(product);

            Assert.IsTrue(repository.GetList().Any(x => x.Name == "Ball" && x.Price == 100));
        }