public void Create_ColectionContainer_0()
        {
            ContainersCollection containersCollection = new ContainersCollection();

            containersCollection.CreateContainerList(1);
            Assert.IsNotNull(containersCollection.ContainerList[0]);
        }
Exemple #2
0
        public void LargeDataTest()
        {
            // Arrange
            var factory       = new DefaultContainerFactory <int>();
            int positionCount = 500;

            Type[]            types      = new Type[50];
            int[][]           points     = new int[types.Count()][];
            Container <int>[] containers = new Container <int> [1000];

            for (int i = 0; i < types.Length; ++i)
            {
                types[i] = typeof(MatrixXY <>);
            }

            for (int i = 0; i < points.Length; ++i)
            {
                points[i] = new int[positionCount];
                for (int j = 0; j < positionCount; ++j)
                {
                    points[i][j] = 0;
                }
            }
            for (int i = 0; i < containers.Length; ++i)
            {
                containers[i] = factory.Create(types, positionCount, points);
            }

            // Act
            ContainersCollection <int> containersCollection = new ContainersCollection <int>(containers);
        }
        public void AutomaticContainer()
        {
            ContainersCollection containersCollection = new ContainersCollection();

            containersCollection.Automatic(1, 1, 1, 1);
            Assert.IsNotNull(containersCollection.ContainerList[0]);
        }
Exemple #4
0
        public void PositionXYZPointsCountTest()
        {
            //// Arrange
            var       factory       = new DefaultContainerFactory <int>();
            const int positionCount = 3;

            Type[] matricesSignatures = new Type[]
            {
                typeof(MatrixX <>),
                typeof(MatrixXY <>),
                typeof(MatrixXYZ <>),
                typeof(MatrixXY <>),
                typeof(MatrixXY <>),
                typeof(MatrixX <>),
                typeof(MatrixXYZ <>),
            };
            int[][] pointsCountForMatricesAndPositions = new int[][]
            {
                new int[] { 300, 2223, 15 },
                new int[] { 13, 0, 4 },
                new int[] { 5, 5, 5 },
                new int[] { 54, 823, 5 },
                new int[] { 428, 5, 1 },
                new int[] { 328, 2, 0 },
                new int[] { 5, 56, 5 }
            };

            Container <int> container = factory.Create(matricesSignatures, positionCount, pointsCountForMatricesAndPositions);

            //// Act
            ContainersCollection <int> containersCollection = new ContainersCollection <int>(container);
        }
Exemple #5
0
 public int CollectionContainerPrint(ContainersCollection Collection)
 {
     int size = 0;
     Console.WriteLine("Numeric Type of CollectionContainer: " + Collection.NumericType);
     Console.WriteLine("Length of CollectionContainer: " + Collection.ListLength);
     foreach (var Container in Collection.ReturnAll())
     {
        size += ContainerPrint(Container);
     }
     return size;
 }
Exemple #6
0
        public static void ToXML(ContainersCollection containersCollection)
        {
            XDocument xd = File.Exists("results.xml") ? XDocument.Load("results.xml") : new XDocument(new XElement("root"));

            xd.Root.Add(new XElement("CollectionContainer",
                                     new XElement("Container", containersCollection.ContainerList),
                                     new XElement("Matrix", containersCollection.MatrixList),
                                     new XElement("Position", containersCollection.PositionList),
                                     new XElement("Point", containersCollection.PointsList)));
            xd.Save("results.xml");
        }
Exemple #7
0
        static void Main(string[] args)
        {
            ContainersCollection containersCollection = new ContainersCollection();

            Dialog(containersCollection);//work program
            string s = "";

            containersCollection.ShowCollections(s); //show collection, and json,
            ToXML(containersCollection);             //write XML file
            Console.ReadKey();
        }
 public static uint PointType(uint buffer, ContainersCollection containersCollection)
 {
     try
     {
         Console.WriteLine("Please Write Type of Points (1d, 2d, 3d) ");
         buffer = uint.Parse(Console.ReadLine());
         return(buffer);
     }
     catch (ArgumentNullException exp)
     {
         Console.WriteLine(exp);
         return(PointType(buffer, containersCollection));
     }
     catch (FormatException exp)
     {
         Console.WriteLine(exp);
         return(PointType(buffer, containersCollection));
     }
 }
 public static void PositionNumber(uint buffer, ContainersCollection containersCollection)
 {
     try
     {
         Console.WriteLine("Please Write Number of Position");
         buffer = uint.Parse(Console.ReadLine());
         containersCollection.CreatePositionList(buffer);
     }
     catch (ArgumentNullException exp)
     {
         Console.WriteLine(exp);
         PositionNumber(buffer, containersCollection);
     }
     catch (FormatException exp)
     {
         Console.WriteLine(exp);
         PositionNumber(buffer, containersCollection);
     }
 }
        public static void PointNumber(uint buffer, ContainersCollection containersCollection)
        {
            try
            {
                switch (ProgramWork.PointType(buffer, containersCollection))
                {
                case 1:
                    Console.WriteLine("Please Write Number Points  ");
                    buffer = uint.Parse(Console.ReadLine());
                    containersCollection.AutoGenereted1DPosition(buffer);

                    break;

                case 2:
                    Console.WriteLine("Please Write Number Points  ");
                    buffer = uint.Parse(Console.ReadLine());
                    containersCollection.AutoGenereted2DPosition(buffer);
                    break;

                case 3:
                    Console.WriteLine("Please Write Number Points  ");
                    buffer = uint.Parse(Console.ReadLine());
                    containersCollection.AutoGenereted3DPosition(buffer);
                    break;

                default: PointNumber(buffer, containersCollection);
                    break;
                }
            }
            catch (ArgumentNullException exp)
            {
                Console.WriteLine(exp);
                PointNumber(buffer, containersCollection);
            }
            catch (FormatException exp)
            {
                Console.WriteLine(exp);
                PointNumber(buffer, containersCollection);
            }
        }
Exemple #11
0
        public static void Dialog(ContainersCollection containersCollection)
        {
            string answer;
            uint   buffer = 0;

            Console.WriteLine("Genereted Collection Automatic? Please Write Y/N");
            answer = Console.ReadLine();
            if (answer == "y")
            {
                containersCollection.Automatic(2, 2, 2, 2);
            }
            else if (answer == "n")
            {
                ProgramWork.ContainerNumber(buffer, containersCollection);
                ProgramWork.MatrixNumber(buffer, containersCollection);
                ProgramWork.PositionNumber(buffer, containersCollection);
                ProgramWork.PointNumber(buffer, containersCollection);
            }
            else
            {
                Dialog(containersCollection);
            }
        }
Exemple #12
0
        public void PositionCountTest()
        {
            // Arrange
            var       factory       = new DefaultContainerFactory <int>();
            const int positionCount = 3;

            Type[] matricesSignatures = new Type[]
            {
                typeof(MatrixXYZ <>),
                typeof(MatrixX <>),
                typeof(MatrixXY <>),
            };
            int[][] pointsCountForMatricesAndPositions = new int[][]
            {
                new int[] { 5, 5, 5 },
                Enumerable.Repeat(4, 3).ToArray(),
                new int[] { 3, 2, 5 }
            };

            Container <int> container = factory.Create(matricesSignatures, positionCount, pointsCountForMatricesAndPositions);

            // Act
            ContainersCollection <int> containersCollection = new ContainersCollection <int>(container);
        }
Exemple #13
0
 public void NumericTypeTest()
 {
     // Act
     ContainersCollection <decimal> containersCollection = new ContainersCollection <decimal>(new Container <decimal> [0]);
 }
Exemple #14
0
 public void NotNumericTypeTest()
 {
     // Act
     ContainersCollection <char> containersCollection = new ContainersCollection <char>(new Container <char> [0]);
 }