Beispiel #1
0
        static void Main(string[] args)
        {
            LegacyObjectMetadataProvider.V1 metadataProviderVersion1 = new LegacyObjectMetadataProvider.V1();
            string metadata = metadataProviderVersion1.ProvideMetadata();

            Console.WriteLine($"Getting product code from {metadata}");
            string code = GetCode(metadata);

            Console.WriteLine($"Recognized code as [{code}]");

            ObjectCodeValidator validator = new ObjectCodeValidator();

            validator.AssertCodeIsValid(code, metadata); //tu walidujemy czy Wasza logika zadziałała

            Console.WriteLine($"Code [{code}] is valid");
            Console.ReadKey();
        }
        public void TestV1()
        {
            var provider = new LegacyObjectMetadataProvider.V1();

            ValidateProvider(provider.ProvideMetadata);
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            //LegacyObjectMetadataProvider.V7 metadataProviderVersion = new LegacyObjectMetadataProvider.V7();

            //string metadata = metadataProviderVersion.ProvideMetadata();

            //Console.WriteLine($"Getting product code from {metadata}");

            //string code = GetCode(metadata);

            //Console.WriteLine($"Recognized code as [{code}]");

            //ObjectCodeValidator validator = new ObjectCodeValidator();

            //validator.AssertCodeIsValid(code, metadata);

            //Console.WriteLine($"Code [{code}] is valid");

            //Console.ReadKey();

            int iterations = 10000;

            for (int i = 1; i <= iterations; i++)
            {
                LegacyObjectMetadataProvider.V1 metadataProviderVersion = new LegacyObjectMetadataProvider.V1();
                string metadata = metadataProviderVersion.ProvideMetadata();
                string code     = GetCode(metadata);
                ObjectCodeValidator validator = new ObjectCodeValidator();
                validator.AssertCodeIsValid(code, metadata);
                Console.WriteLine($"Code [{code}] is valid");
            }
            for (int i = 1; i <= iterations; i++)
            {
                LegacyObjectMetadataProvider.V2 metadataProviderVersion = new LegacyObjectMetadataProvider.V2();
                string metadata = metadataProviderVersion.ProvideMetadata();
                string code     = GetCode(metadata);
                ObjectCodeValidator validator = new ObjectCodeValidator();
                validator.AssertCodeIsValid(code, metadata);
                Console.WriteLine($"Code [{code}] is valid");
            }
            for (int i = 1; i <= iterations; i++)
            {
                LegacyObjectMetadataProvider.V3 metadataProviderVersion = new LegacyObjectMetadataProvider.V3();
                string metadata = metadataProviderVersion.ProvideMetadata();
                string code     = GetCode(metadata);
                ObjectCodeValidator validator = new ObjectCodeValidator();
                validator.AssertCodeIsValid(code, metadata);
                Console.WriteLine($"Code [{code}] is valid");
            }
            for (int i = 1; i <= iterations; i++)
            {
                LegacyObjectMetadataProvider.V4 metadataProviderVersion = new LegacyObjectMetadataProvider.V4();
                string metadata = metadataProviderVersion.ProvideMetadata();
                string code     = GetCode(metadata);
                ObjectCodeValidator validator = new ObjectCodeValidator();
                validator.AssertCodeIsValid(code, metadata);
                Console.WriteLine($"Code [{code}] is valid");
            }
            for (int i = 1; i <= iterations; i++)
            {
                LegacyObjectMetadataProvider.V5 metadataProviderVersion = new LegacyObjectMetadataProvider.V5();
                string metadata = metadataProviderVersion.ProvideMetadata();
                string code     = GetCode(metadata);
                ObjectCodeValidator validator = new ObjectCodeValidator();
                validator.AssertCodeIsValid(code, metadata);
                Console.WriteLine($"Code [{code}] is valid");
            }
            for (int i = 1; i <= iterations; i++)
            {
                LegacyObjectMetadataProvider.V6 metadataProviderVersion = new LegacyObjectMetadataProvider.V6();
                string metadata = metadataProviderVersion.ProvideMetadata();
                string code     = GetCode(metadata);
                ObjectCodeValidator validator = new ObjectCodeValidator();
                validator.AssertCodeIsValid(code, metadata);
                Console.WriteLine($"Code [{code}] is valid");
            }
            for (int i = 1; i <= iterations; i++)
            {
                LegacyObjectMetadataProvider.V7 metadataProviderVersion = new LegacyObjectMetadataProvider.V7();
                string metadata = metadataProviderVersion.ProvideMetadata();
                string code     = GetCode(metadata);
                ObjectCodeValidator validator = new ObjectCodeValidator();
                validator.AssertCodeIsValid(code, metadata);
                Console.WriteLine($"Code [{code}] is valid");
            }
            Console.ReadKey();
        }