Beispiel #1
0
 public void Setup()
 {
     _mockHttpClient    = new Mock <IHttpClient>();
     _mockJsonConverter = new Mock <IJsonDeserializer>();
     _mockWebConfig     = new Mock <IWebConfig>();
     _mockWebConfig.SetupGet(x => x.RestaurantsApiUrl).Returns("http://something.com/");
     _restaurantsManager = new Managers.RestaurantsManager(_mockHttpClient.Object, _mockWebConfig.Object, _mockJsonConverter.Object);
 }
Beispiel #2
0
        public virtual (Result result, V domain) Retrieve(IQueryDomain <S, T, U, V> query, int maxdepth = 1, V domain = default(V))
        {
            var selectsingle = query.Data.SelectSingle(maxdepth, (domain != null ? domain.Data : default(U)));

            if (selectsingle.result.Success && selectsingle.data != null)
            {
                var instance = Business.HelperLogic <T, U, V> .CreateInstance(selectsingle.data);

                Load(instance, maxdepth);

                instance.Changed = false;
                instance.Deleted = false;

                return(selectsingle.result, instance);
            }

            return(selectsingle.result, default(V));
        }
Beispiel #3
0
        public virtual (Result result, IEnumerable <V> domains) List(IQueryDomain <S, T, U, V> query, int maxdepth = 1, int top = 0, IListDomain <T, U, V> domains = null)
        {
            var enumeration = new List <V>();

            var selectmultiple = query.Data.Select(maxdepth, top, (domains?.Datas != null ? domains?.Datas : new ListData <T, U>()));

            if (selectmultiple.result.Success && selectmultiple.datas != null)
            {
                foreach (var instance in LoadDatas(selectmultiple.datas, maxdepth))
                {
                    instance.Changed = false;
                    instance.Deleted = false;

                    enumeration.Add(instance);
                }

                return(selectmultiple.result, enumeration);
            }

            return(selectmultiple.result, default(IList <V>));
        }
Beispiel #4
0
 public RestaurantsController(IQueryDomain <RestaurantResults> queryRestaurants)
 {
     _queryRestaurants = queryRestaurants;
 }