コード例 #1
0
        public static Item GetSource(IStoreItem destination, CommonFixture commonFixture)
        {
            Item predecessor = null;

            if (destination.Predecessor != null)
            {
                predecessor = GetSource(destination.Predecessor, commonFixture);
            }

            var availabilities = destination.Availabilities
                                 .Select(av => StoreItemAvailabilityConverterTests.GetSource(av))
                                 .ToList();

            return(new Item
            {
                Id = destination.Id.Value,
                Name = destination.Name,
                Deleted = destination.IsDeleted,
                Comment = destination.Comment,
                IsTemporary = destination.IsTemporary,
                QuantityType = destination.QuantityType.ToInt(),
                QuantityInPacket = destination.QuantityInPacket,
                QuantityTypeInPacket = destination.QuantityTypeInPacket.ToInt(),
                ItemCategoryId = destination.ItemCategoryId?.Value,
                ManufacturerId = destination.ManufacturerId?.Value,
                PredecessorId = predecessor?.Id,
                Predecessor = predecessor,
                AvailableAt = availabilities,
                CreatedFrom = destination.TemporaryId?.Value
            });
        }
コード例 #2
0
        public OrgDetailsMgtControllerTest(CommonFixture commonFixture)
        {
            this.commonFixture = commonFixture;

            //Generate Token
            commonFixture.LoginAndGetToken();

            orgDetailsMgtController = new LUOrgDetailsManageController(Bootstrapper.Container);

            orgDetailsMgtController.ServiceAuthorizedKey = commonFixture.StrToken;

            FunMgtHelper       funMgtHelper       = Bootstrapper.Container.GetExportedValue <FunMgtHelper>();
            OrgDetailMgtHelper orgDetailMgtHelper = Bootstrapper.Container.GetExportedValue <OrgDetailMgtHelper>();
            RoleMgtHelper      roleMgtHelper      = Bootstrapper.Container.GetExportedValue <RoleMgtHelper>();

            orgDetailsMgtController.funMgtHelper       = new Lazy <FunMgtHelper>(() => funMgtHelper);
            orgDetailsMgtController.orgDetailMgtHelper = new Lazy <OrgDetailMgtHelper>(() => orgDetailMgtHelper);
            orgDetailsMgtController.roleMgtHelper      = new Lazy <RoleMgtHelper>(() => roleMgtHelper);

            orgDetailsMgtController.TempData[StaticContent.LanguageKey] = this.commonFixture.LanguageKey;

            orgDetailsMgtController.FunKey     = "LUOrgDetailsManage";
            orgDetailsMgtController.FunTypeKey = "Create";

            #region [ Initialize List ]
            WCFAuthInfoVM entity_WCFAuthInfoVM = new WCFAuthInfoVM("", "", commonFixture.StrToken, orgDetailsMgtController.FunKey, orgDetailsMgtController.FunTypeKey, this.commonFixture.LanguageKey.ToString(), "");
            //All Fun
            entityList_FunVM = orgDetailsMgtController.funMgtHelper.Value.GetAll(entity_WCFAuthInfoVM);
            //All Role
            entityList_RoleVM = orgDetailsMgtController.roleMgtHelper.Value.GetAll(entity_WCFAuthInfoVM);
            #endregion
        }
            public IStoreItem CreateItem()
            {
                var itemCategoryId = new ItemCategoryId(CommonFixture.NextInt());
                var manufacturerId = new ManufacturerId(CommonFixture.NextInt());

                return(CreateItem(itemCategoryId, manufacturerId));
            }
コード例 #4
0
        public OrgMgtControllerTest(CommonFixture commonFixture)
        {
            this.commonFixture = commonFixture;

            //Generate Token
            commonFixture.LoginAndGetToken();

            orgMgtController = new LUOrganizationManageController(Bootstrapper.Container);

            orgMgtController.ServiceAuthorizedKey = commonFixture.StrToken;

            FunMgtHelper       funMgtHelper       = Bootstrapper.Container.GetExportedValue <FunMgtHelper>();
            OrgDetailMgtHelper orgDetailMgtHelper = Bootstrapper.Container.GetExportedValue <OrgDetailMgtHelper>();
            OrgMgtHelper       orgMgtHelper       = Bootstrapper.Container.GetExportedValue <OrgMgtHelper>();
            RoleMgtHelper      roleMgtHelper      = Bootstrapper.Container.GetExportedValue <RoleMgtHelper>();

            orgMgtController.funMgtHelper       = new Lazy <FunMgtHelper>(() => funMgtHelper);
            orgMgtController.orgDetailMgtHelper = new Lazy <OrgDetailMgtHelper>(() => orgDetailMgtHelper);
            orgMgtController.orgMgtHelper       = new Lazy <OrgMgtHelper>(() => orgMgtHelper);
            orgMgtController.roleMgtHelper      = new Lazy <RoleMgtHelper>(() => roleMgtHelper);

            orgMgtController.TempData[StaticContent.LanguageKey] = this.commonFixture.LanguageKey;

            orgMgtController.FunKey = "LUOrganizationManage";
        }
コード例 #5
0
            public LocalFixture()
            {
                Fixture = CommonFixture.GetNewFixture();

                ItemCategoryRepositoryMock = new ItemCategoryRepositoryMock(Fixture);

                ItemCategoryFixture = new ItemCategoryFixture(CommonFixture);
            }
            public LocalFixture()
            {
                Fixture = CommonFixture.GetNewFixture();

                ManufacturerRepositoryMock = new ManufacturerRepositoryMock(Fixture);

                ManufacturerFixture = new ManufacturerFixture(CommonFixture);
            }
            public CreateTemporaryItemCommand CreateCommand(IStoreItemAvailability availability)
            {
                var fixture = CommonFixture.GetNewFixture();

                fixture.ConstructorArgumentFor <TemporaryItemCreation, IStoreItemAvailability>("availability", availability);

                return(fixture.Create <CreateTemporaryItemCommand>());
            }
コード例 #8
0
 public ShoppingListTests()
 {
     commonFixture                  = new CommonFixture();
     shoppingListItemFixture        = new ShoppingListItemFixture(commonFixture);
     shoppingListSectionFixture     = new ShoppingListSectionFixture(commonFixture);
     shoppingListFixture            = new ShoppingListFixture(commonFixture).AsModelFixture();
     shoppingListSectionMockFixture = new ShoppingListSectionMockFixture(shoppingListSectionFixture, commonFixture);
 }
        public FinishShoppingListCommandHandlerTests()
        {
            commonFixture = new CommonFixture();
            shoppingListSectionFixture = new ShoppingListSectionFixture(commonFixture);
            var shoppingListFixture = new ShoppingListFixture(commonFixture);

            shoppingListMockFixture = new ShoppingListMockFixture(commonFixture, shoppingListFixture);
        }
        protected override (AvailableAt, IStoreItemAvailability) CreateTestObjects()
        {
            var commonFixture       = new CommonFixture();
            var availabilityFixture = new StoreItemAvailabilityFixture(commonFixture);
            var destination         = availabilityFixture.CreateValid();
            var source = GetSource(destination);

            return(source, destination);
        }
            public LocalFixture()
            {
                Fixture = CommonFixture.GetNewFixture();

                ShoppingListMockFixture = new ShoppingListMockFixture(CommonFixture, new ShoppingListFixture(CommonFixture));

                ShoppingListRepositoryMock       = new ShoppingListRepositoryMock(Fixture);
                AddItemToShoppingListServiceMock = new AddItemToShoppingListServiceMock(Fixture);
            }
コード例 #12
0
            public ChangeItemQuantityOnShoppingListCommand CreateCommandWithActualId()
            {
                var offlineTolerantItemId = new OfflineTolerantItemId(CommonFixture.NextInt());

                Fixture.ConstructorArgumentFor <ChangeItemQuantityOnShoppingListCommand, OfflineTolerantItemId>("itemId",
                                                                                                                offlineTolerantItemId);

                return(Fixture.Create <ChangeItemQuantityOnShoppingListCommand>());
            }
            public PutItemInBasketCommand CreateCommandWithActualId()
            {
                var offlineTolerantItemId = new OfflineTolerantItemId(CommonFixture.NextInt());

                Fixture.ConstructorArgumentFor <PutItemInBasketCommand, OfflineTolerantItemId>("itemId",
                                                                                               offlineTolerantItemId);

                return(Fixture.Create <PutItemInBasketCommand>());
            }
        protected override (Section, IStoreSection) CreateTestObjects()
        {
            var commonFixture       = new CommonFixture();
            var storeSectionFixture = new StoreSectionFixture(commonFixture);

            var destination = storeSectionFixture.Create(new StoreSectionDefinition());
            var source      = GetSource(destination, commonFixture);

            return(source, destination);
        }
コード例 #15
0
        protected override (Entities.Manufacturer, IManufacturer) CreateTestObjects()
        {
            var commonFixture = new CommonFixture();
            var domainFixture = new ManufacturerFixture(commonFixture);

            var destination = domainFixture.Create();
            var source      = GetSource(destination);

            return(source, destination);
        }
コード例 #16
0
        protected override (IStore, Entities.Store) CreateTestObjects()
        {
            var commonFixture = new CommonFixture();
            var storeFixture  = new StoreFixture(commonFixture);

            var source      = storeFixture.CreateValid();
            var destination = GetDestination(source);

            return(source, destination);
        }
            public LocalFixture()
            {
                Fixture = CommonFixture.GetNewFixture();

                StoreItemFixture = new StoreItemFixture(new StoreItemAvailabilityFixture(CommonFixture), CommonFixture);

                ItemRepositoryMock   = new ItemRepositoryMock(Fixture);
                StoreItemFactoryMock = new StoreItemFactoryMock(Fixture);
                AvailabilityValidationServiceMock = new AvailabilityValidationServiceMock(Fixture);
            }
            public LocalFixture()
            {
                Fixture = CommonFixture.GetNewFixture();

                StoreRepositoryMock = new StoreRepositoryMock(Fixture);

                StoreItemAvailabilityFixture = new StoreItemAvailabilityFixture(CommonFixture);
                StoreSectionFixture          = new StoreSectionFixture(CommonFixture);
                StoreFixture = new StoreFixture(CommonFixture);
            }
 public static Section GetSource(IStoreSection destination, CommonFixture commonFixture)
 {
     return(new Section()
     {
         Id = destination.Id.Value,
         Name = destination.Name,
         SortIndex = destination.SortingIndex,
         IsDefaultSection = destination.IsDefaultSection
     });
 }
コード例 #20
0
        protected override (Entities.ShoppingList, IShoppingList) CreateTestObjects()
        {
            var commonFixture       = new CommonFixture();
            var shoppingListFixture = new ShoppingListFixture(commonFixture).AsModelFixture();

            var destination = shoppingListFixture.CreateValid();
            var source      = GetSource(destination);

            return(source, destination);
        }
            public LocalFixture()
            {
                Fixture = CommonFixture.GetNewFixture();

                StoreItemFixture        = new StoreItemFixture(new StoreItemAvailabilityFixture(CommonFixture), CommonFixture);
                ShoppingListMockFixture = new ShoppingListMockFixture(CommonFixture, new ShoppingListFixture(CommonFixture));

                ShoppingListRepositoryMock = new ShoppingListRepositoryMock(Fixture);
                ItemRepositoryMock         = new ItemRepositoryMock(Fixture);
            }
        protected override (Entities.ItemCategory, IItemCategory) CreateTestObjects()
        {
            var commonFixture = new CommonFixture();
            var domainFixture = new ItemCategoryFixture(commonFixture);

            var destination = domainFixture.GetItemCategory();
            var source      = GetSource(destination);

            return(source, destination);
        }
        protected override (IManufacturer, Entities.Manufacturer) CreateTestObjects()
        {
            var commonFixture = new CommonFixture();
            var domainFixture = new ManufacturerFixture(commonFixture);

            var source      = domainFixture.Create();
            var destination = ToDomain.ManufacturerConverterTests.GetSource(source);

            return(source, destination);
        }
コード例 #24
0
        protected override (IItemCategory, Entities.ItemCategory) CreateTestObjects()
        {
            var commonFixture = new CommonFixture();
            var domainFixture = new ItemCategoryFixture(commonFixture);

            var source      = domainFixture.GetItemCategory();
            var destination = ToDomain.ItemCategoryConverterTests.GetSource(source);

            return(source, destination);
        }
コード例 #25
0
        protected override (IStoreItem, Item) CreateTestObjects()
        {
            var commonFixture       = new CommonFixture();
            var availabilityFixture = new StoreItemAvailabilityFixture(commonFixture);
            var storeItemFixture    = new StoreItemFixture(availabilityFixture, commonFixture);

            var source      = storeItemFixture.CreateValid();
            var destination = GetDestination(source);

            return(source, destination);
        }
            public LocalFixture()
            {
                Fixture = CommonFixture.GetNewFixture();

                StoreItemFixture     = new StoreItemFixture(new StoreItemAvailabilityFixture(CommonFixture), CommonFixture);
                StoreItemMockFixture = new StoreItemMockFixture(CommonFixture, StoreItemFixture);

                ShoppingListRepositoryMock = new ShoppingListRepositoryMock(Fixture);
                ItemRepositoryMock         = new ItemRepositoryMock(Fixture);
                TransactionGeneratorMock   = new TransactionGeneratorMock(Fixture);
            }
コード例 #27
0
        public DeleteItemCategoryCommandHandlerTests()
        {
            commonFixture = new CommonFixture();
            var shoppingListFixture          = new ShoppingListFixture(commonFixture);
            var storeItemAvailabilityFixture = new StoreItemAvailabilityFixture(commonFixture);
            var storeItemFixture             = new StoreItemFixture(storeItemAvailabilityFixture, commonFixture);
            var itemCategoryFixture          = new ItemCategoryFixture(commonFixture);

            itemCategoryMockFixtur  = new ItemCategoryMockFixture(commonFixture, itemCategoryFixture);
            storeItemMockFixture    = new StoreItemMockFixture(commonFixture, storeItemFixture);
            shoppingListMockFixture = new ShoppingListMockFixture(commonFixture, shoppingListFixture);
        }
            public ShoppingListMock CreateValidShoppingListMock(IStoreItem storeItem)
            {
                var storeId = CommonFixture.ChooseRandom(storeItem.Availabilities).StoreId;

                var listDef = new ShoppingListDefinition
                {
                    StoreId = storeId
                };
                var list = ShoppingListFixture.CreateValid(listDef);

                return(new ShoppingListMock(list));
            }
            public ShoppingListMock CreateShoppingListMockWithIncompatibleStore(IStoreItem storeItem)
            {
                var storeIds = storeItem.Availabilities.Select(av => av.StoreId.Value);

                var listDef = new ShoppingListDefinition
                {
                    StoreId = new StoreId(CommonFixture.NextInt(storeIds))
                };
                var list = ShoppingListFixture.CreateValid(listDef);

                return(new ShoppingListMock(list));
            }
            public IEnumerable <IStoreItemAvailability> CreateAvailabilitiesWithDuplicatedStoreIds()
            {
                var availabilities = StoreItemAvailabilityFixture.CreateManyValid().ToList();

                var def = new StoreItemAvailabilityDefinition
                {
                    StoreId = CommonFixture.ChooseRandom(availabilities).StoreId
                };

                availabilities.Add(StoreItemAvailabilityFixture.Create(def));

                return(availabilities);
            }