public void EqualsYNull()
        {
            var x = new Definition()
            {
                Preface = Guid.NewGuid().ToString(),
                Name = Guid.NewGuid().ToString(),
            };

            var c = new DefinitionComparer();
            c.Equals(x, null);
        }
        public void EqualsSame()
        {
            var preface = Guid.NewGuid().ToString();
            var name = Guid.NewGuid().ToString();
            var x = new Definition()
            {
                Preface = preface,
                Name = name,
            };

            var c = new DefinitionComparer();
            Assert.IsTrue(c.Equals(x, x));
        }
        public void Equalsfalse()
        {
            var x = new Definition()
            {
                Preface = Guid.NewGuid().ToString(),
                Name = Guid.NewGuid().ToString(),
            };
            var y = new Definition()
            {
                Preface = Guid.NewGuid().ToString(),
                Name = Guid.NewGuid().ToString(),
            };

            var c = new DefinitionComparer();
            Assert.IsFalse(c.Equals(x, y));
        }
        public void GetHashCodeTest()
        {
            var x = new Definition()
            {
                Preface = Guid.NewGuid().ToString(),
                Name = Guid.NewGuid().ToString(),
            };

            var hash = string.Format("{0}{1}", x.Preface, x.Name).GetHashCode();
            var c = new DefinitionComparer();
            Assert.AreEqual(hash, c.GetHashCode(x));
        }
 public void GetHashCodeDefinitionNull()
 {
     var c = new DefinitionComparer();
     c.GetHashCode(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());
        }