public void TestV7()
        {
            var provider = new LegacyObjectMetadataProvider.V7();

            ValidateProvider(provider.ProvideMetadata);
        }
Ejemplo n.º 2
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();
        }