public void CreatesCorrectPolicy(string headerName, string headerValue, ExistsAction existsAction)
        {
            var basePolicy = new SetHeaderParameter(headerName, headerValue, existsAction);
            var xml        = basePolicy.GetXml().ToString();

            xml.Should().Be(
                $@"<set-header name=""{headerName}"" exists-action=""{ExistsActionMapper.Map(existsAction)}"">
  <value>{headerValue}</value>
</set-header>"
                );
        }
Beispiel #2
0
        public IDatabaseComparer Index(IIndex index)
        {
            existsAction = delegate(IDatabase targetDB)
            {
                ITable indexTable = targetDB.Tables[index.Table.Name];
                if (indexTable == null)
                {
                    return(false);
                }

                return(indexTable.Indexes[index.Name] != null);
            };

            return(this);
        }
Beispiel #3
0
        public IDatabaseComparer ForeignKey(IForeignKey fk)
        {
            existsAction = delegate(IDatabase targetDB)
            {
                ITable fkTable = targetDB.Tables[fk.ForeignTable.Name];
                if (fkTable == null)
                {
                    return(false);
                }

                return(fkTable.ForeignKeys[fk.Name] != null);
            };

            return(this);
        }
Beispiel #4
0
        public IDatabaseComparer Column(IColumn column)
        {
            existsAction = delegate(IDatabase targetDB)
            {
                ITable table = targetDB.Tables[column.Table.Name];
                if (table == null)
                {
                    return(false);
                }

                return(table.Columns[column.Name] != null);
            };

            return(this);
        }
Beispiel #5
0
        public IDatabaseComparer Table(ITable table)
        {
            existsAction = delegate(IDatabase targetDB) { return(targetDB.Tables[table.Name] != null); };

            return(this);
        }