Пример #1
0
        public async Task EndToEndProcessing()
        {
            var config      = TestHelper.GetApplicationConfiguration(Environment.CurrentDirectory);
            var retsSession = new RetsSession(config.LoginUrl);

            if (await retsSession.LoginAsync(config.Username, config.Password, config.UserAgent))
            {
                var metadata = await retsSession.GetMetadataAsync();

                foreach (var resource in metadata.Resources)
                {
                    _output.WriteLine($"Resource: {resource.StandardName} [{resource.VisibleName}]");
                    foreach (var retsClass in resource.Classes)
                    {
                        _output.WriteLine($"Class: {retsClass.StandardName} [{retsClass.VisibleName}]");
                        _output.WriteLine($"Tables:");
                        foreach (var table in retsClass.Tables)
                        {
                            _output.WriteLine("=====================================================================");
                            _output.WriteLine($"Table: Resource-{table.Resource} Class:{table.Class}");
                            _output.WriteLine("=====================================================================");
                            foreach (var field in table.Fields)
                            {
                                _output.WriteLine($"{field.StandardName,40} ({field.DataType}:{field.Precision})");
                            }
                        }
                    }
                }

                // todo: call other session methods

                await retsSession.LogoutAsync();
            }
        }