public void BuildManifestSchemaNull()
 {
     var executor = Substitute.For<IExecutor>();
     var statements = Substitute.For<IStatements>();
     var dl = new SchemaReader(executor, statements);
     dl.BuildManifest(new List<Definition>(), null);
 }
        public void BuildManifest()
        {
            var random = new Random();
            var defs = new List<Definition>();
            var schemas = new List<Schema>();
            var schema = new Schema()
            {
                Name = Guid.NewGuid().ToString(),
                Preface = Guid.NewGuid().ToString(),
            };
            var def = schema.Map<Definition>();
            defs.Add(def);

            var schemaCount = random.Next(15);
            for (var i = 0; i < schemaCount; i++)
            {
                var s = new Schema()
                {
                    Name = schema.Name,
                    Preface = schema.Preface,
                    DataType = Guid.NewGuid().ToString(),
                    ParameterName = Guid.NewGuid().ToString(),
                };
                schemas.Add(s);
            }
            var count = random.Next(15);
            for (var i = 0; i < count; i++)
            {
                var d = new Definition()
                {
                    Name = Guid.NewGuid().ToString(),
                    Preface = Guid.NewGuid().ToString(),
                };
                defs.Add(d);
            }

            var executor = Substitute.For<IExecutor>();
            var statements = Substitute.For<IStatements>();

            var dl = new SchemaReader(executor, statements);
            var manifest = dl.BuildManifest(defs, schemas);

            Assert.IsNotNull(manifest);
            Assert.AreEqual(count + 1, manifest.Count());
            var c = new DefinitionComparer();
            Assert.AreEqual(schemaCount, manifest.ElementAt(0).Variables.Count());
        }
 public void BuildManifestEmtpy()
 {
     var executor = Substitute.For<IExecutor>();
     var statements = Substitute.For<IStatements>();
     var dl = new SchemaReader(executor, statements);
     var returned = dl.BuildManifest(new List<Definition>(), new List<Schema>());
     Assert.IsNotNull(returned);
     Assert.AreEqual(0, returned.Count());
 }