Exemplo n.º 1
0
        public virtual void ItFecthesCategoryLevelMapping()
        {
            // create entity
            var entity1 = App.Factory.Create <Category>(OnCreateOverrides);
            var entity2 = App.Factory.Create <Category>(item =>
            {
                OnCreateOverrides?.Invoke(item);
                item.ParentCategoryId = entity1.Id;
            });
            var entity3 = App.Factory.Create <Category>(item =>
            {
                OnCreateOverrides?.Invoke(item);
                item.ParentCategoryId = entity2.Id;
            });

            // check entity fetched
            var mappingFetched = ((CategoryService)serviceIdManageable).GetCategoryLevelMapping(user.Id);

            mappingFetched.Should().ContainKey(entity1.Id);
            mappingFetched[entity1.Id].ShouldBeEquivalentTo(0);
            mappingFetched.Should().ContainKey(entity2.Id);
            mappingFetched[entity2.Id].ShouldBeEquivalentTo(1);
            mappingFetched.Should().ContainKey(entity3.Id);
            mappingFetched[entity3.Id].ShouldBeEquivalentTo(2);
        }
Exemplo n.º 2
0
        public virtual void ItFecthesLowestCategoryLevel()
        {
            // create entity
            var entity1 = App.Factory.Create <Category>(OnCreateOverrides);
            var entity2 = App.Factory.Create <Category>(item =>
            {
                OnCreateOverrides?.Invoke(item);
                item.ParentCategoryId = entity1.Id;
            });

            // check entity fetched
            var entityFetched = ((CategoryService)serviceIdManageable).GetLowestCategoryLevel(user.Id);

            entityFetched.ShouldBeEquivalentTo(1);
        }
        public virtual void ItFecthesMainCurrency()
        {
            var currencyService = (CurrencyService)serviceIdManageable;

            // create entity
            var entity = App.Factory.Create <Currency>(item =>
            {
                OnCreateOverrides?.Invoke(item);
                item.IsActive = true;
            });

            currencyService.SetMain(user.Id, entity.Id);

            // check entity fetched
            var entityFetched = ((CurrencyService)serviceIdManageable).GetMain(user.Id);

            entityFetched.Should().NotBeNull();
            CheckAreEquivalent(entityFetched, converter.ToModel(entity));
        }
        public virtual void ItSetsMainCurrency()
        {
            var currencyService = (CurrencyService)serviceIdManageable;

            // create entity
            var entity = App.Factory.Create <Currency>(item =>
            {
                OnCreateOverrides?.Invoke(item);
                item.IsActive = true;
            });

            currencyService.SetMain(user.Id, entity.Id);

            // check entity is main currency
            var currencies = currencyService.GetListForUser(user.Id).Where(_ => _.IsMain).ToList();

            currencies.Count.ShouldBeEquivalentTo(1);
            CheckAreEquivalent(currencies[0], converter.ToModel(entity));
        }