Ejemplo n.º 1
0
 /// <summary>
 /// Configures the stack collection.
 /// </summary>
 /// <owner>Anton Petrenko</owner>
 /// <param name="selectedBasicCollection">The selected type of collection (array/linked list).</param>
 private static void ConfigureStack(BasicCollectionType selectedBasicCollection)
 {
     if (selectedBasicCollection == BasicCollectionType.Array)
     {
         CustomCollectionConfig <T> .container.RegisterType <ArrayStack <T> >().As <ICustomCollection <T> >();
     }
     else if (selectedBasicCollection == BasicCollectionType.LinkedList)
     {
         CustomCollectionConfig <T> .container.RegisterType <LinkedListStack <T> >().As <ICustomCollection <T> >();
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Configures the instances.
        /// </summary>
        /// <owner>Anton Petrenko</owner>
        /// <param name="selectedCustomCollection">The selected custom type of collection (queue/stack).</param>
        /// <param name="selectedBasicCollection">The selected basic type of collection (array/linked list).</param>
        /// <returns>The instances.</returns>
        public static IContainer Configure(CustomCollectionType selectedCustomCollection, BasicCollectionType selectedBasicCollection)
        {
            CustomCollectionConfig <T> .container = new ContainerBuilder();

            if (selectedCustomCollection == CustomCollectionType.Stack)
            {
                CustomCollectionConfig <T> .ConfigureStack(selectedBasicCollection);
            }
            else if (selectedCustomCollection == CustomCollectionType.Queue)
            {
                CustomCollectionConfig <T> .ConfigureQueue(selectedBasicCollection);
            }

            return(CustomCollectionConfig <T> .container.Build());
        }
Ejemplo n.º 3
0
        public void CollectionConfigCreator_InitializeCollection_WhenCalled_GetCustomCollectionOfCorrectType(CustomCollectionType selectedQueueStackType,
                                                                                                             BasicCollectionType selectedArrayLinkedListType, Type expectedType)
        {
            //
            // Act.
            //
            var actualCollection = creator.InitializeCollection(selectedQueueStackType, selectedArrayLinkedListType);

            //
            // Assert.
            //
            Assert.IsInstanceOfType(actualCollection, expectedType);
        }