public void MapsNativeGuidParamPrefix()
        {
            bool   nativeGuid = _faker.Random.Bool();
            string prefix     = _faker.Random.AlphaNumeric(1);

            DbParameterFormatter formatter = new DbParameterFormatter(nativeGuid, prefix);

            Assert.IsTrue(formatter.HasNativeGuidSupport == nativeGuid);
            Assert.IsTrue(formatter.ParameterNamePrefix == prefix);
        }
        public void GetGuidString()
        {
            DbParameterFormatter formatter = new DbParameterFormatter(false);
            Employee             model     = new Employee()
            {
                EmployeeID = Guid.NewGuid()
            };

            Assert.AreEqual(formatter.MapParameterValue(model.EmployeeID, model.GetType().GetProperty(nameof(model.EmployeeID))), model.EmployeeID.ToString());
        }
        public void MapNonNativeGuidProperty()
        {
            Guid guid = _faker.Random.Guid();
            DbParameterFormatter formatter = new DbParameterFormatter(false);
            CustomDbParameter    parameter = new CustomDbParameter();
            PropertyInfo         info      = typeof(Employee).GetProperty(nameof(Employee.EmployeeID));

            formatter.MapDbParameter(parameter, guid, info);

            Assert.IsInstanceOf(typeof(string), parameter.Value);
            Assert.IsTrue(parameter.DbType == DbType.String);
            Assert.IsTrue((string)parameter.Value == guid.ToString());
            Assert.IsTrue(parameter.Size == 40);
        }
 public void Setup()
 {
     _formatter = new DbParameterFormatter(_faker.Random.Bool());
 }
        public void MapsNonNativeGuidCorrectly()
        {
            DbParameterFormatter formatter = new DbParameterFormatter(false);

            Assert.That(formatter.MapDbType(typeof(DbTypeModel).GetProperty(nameof(DbTypeModel.Guid))) == DbType.String);
        }