/// <summary> /// Initializes the collection. /// </summary> /// <owner>Anton Petrenko</owner> /// <param name="selectedCustomCollection">The selected type of custom collection (queue/stack).</param> /// <param name="selectedBasicCollection">The selected type of basic collection (array/linked list).</param> /// <returns>The initialized collection.</returns> public ICustomCollection <T> InitializeCollection(CustomCollectionType selectedCustomCollection, BasicCollectionType?selectedBasicCollection) { if (!selectedBasicCollection.HasValue || selectedCustomCollection == CustomCollectionType.None) { throw new ArgumentException("Select all settings for the collection."); } var container = CustomCollectionConfig <T> .Configure(selectedCustomCollection, selectedBasicCollection.Value); return(container.Resolve <ICustomCollection <T> >()); }
public static IEdmModel InterfaceCriticalPropertyValueMustNotBeNullUsingCollectionTypeModel() { var model = new EdmModel(); var badType = new CustomCollectionType(null, EdmTypeKind.Collection); var badTypeRef = new EdmCollectionTypeReference(badType); var valueTerm = new EdmTerm("NS", "Note", badTypeRef); model.AddElement(valueTerm); return(model); }
public static IEdmModel InterfaceCriticalKindValueMismatchOnlyUsingCollectionTypeReferenceModel() { var model = new EdmModel(); var badType = new CustomCollectionType(new EdmStringTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.String), false), EdmTypeKind.Enum); var badTypeRef = new EdmCollectionTypeReference(badType); var valueTerm = new EdmTerm("NS", "Note", badTypeRef); model.AddElement(valueTerm); return(model); }
/// <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()); }
public static IEdmModel InterfaceCriticalPropertyValueMustNotBeNullUsingCollectionTypeModel() { var model = new EdmModel(); var badType = new CustomCollectionType(null, EdmTypeKind.Collection); var badTypeRef = new EdmCollectionTypeReference(badType); var valueTerm = new EdmTerm("NS", "Note", badTypeRef); model.AddElement(valueTerm); return model; }
public static IEdmModel InterfaceCriticalKindValueMismatchOnlyUsingCollectionTypeReferenceModel() { var model = new EdmModel(); var badType = new CustomCollectionType(new EdmStringTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.String), false), EdmTypeKind.Enum); var badTypeRef = new EdmCollectionTypeReference(badType); var valueTerm = new EdmTerm("NS", "Note", badTypeRef); model.AddElement(valueTerm); return model; }
public void CollectionConfigCreator_InitializeCollection_WhenCalled_GetCustomCollectionOfCorrectType(CustomCollectionType selectedQueueStackType, BasicCollectionType selectedArrayLinkedListType, Type expectedType) { // // Act. // var actualCollection = creator.InitializeCollection(selectedQueueStackType, selectedArrayLinkedListType); // // Assert. // Assert.IsInstanceOfType(actualCollection, expectedType); }