Example #1
0
        public void Parameters_DuplicateParameters_AnExceptionIsThrownWhenDuplicateParametersAreFound()
        {
            var database = new MsSqlDatabase();

            Fixture fixture = new Fixture();
            var duplicate = fixture.CreateAnonymous<DuplicateParameters>();

            database.ConvertToParameters(duplicate);
        }
Example #2
0
        public void Parameters_ThirdLevelClass_PropertiesAreConvertedToDbParameters()
        {
            var database = new MsSqlDatabase();
            Fixture fixture = new Fixture();
            var user = fixture.CreateAnonymous<ThirdLevelClass>();
            var propertyNames = new[] { "@Id", "@FirstName", "@LastName", "@Email", "@Password", "@CreateTime", "@UpdateDatetime" };

            var parameters = database.ConvertToParameters(user);
            var parameterNames = parameters.Select(d => d.ParameterName).ToArray();

            Assert.That(parameterNames, Is.EquivalentTo(propertyNames));
            Console.WriteLine(string.Join(", ", parameterNames));
        }
Example #3
0
        public void Parameters_SingleLevelClass_PropertiesAreConvertedToDbParameters()
        {
            Fixture fixture = new Fixture();
            var user = fixture.CreateAnonymous<SingleLevelClass>();
            var propertyNames = user.GetType().GetProperties().Select(p => "@" + p.Name).ToArray();
            var database = new MsSqlDatabase();

            var parameters = database.ConvertToParameters(user);
            var parameterNames = parameters.Select(d => d.ParameterName).ToArray();

            Assert.That(parameterNames, Is.EquivalentTo(propertyNames));
            Console.WriteLine(string.Join(", ", parameterNames));
        }