Хотя вопрос о Moq 3 (вероятно, из-за его возраста), позвольте мне опубликовать решение для Moq 4.8, которое значительно улучшило поддержку параметров ref-ref.
public interface IGobbler
{
bool Gobble(ref int amount);
}
delegate void GobbleCallback(ref int amount); // needed for Callback
delegate bool GobbleReturns(ref int amount); // needed for Returns
var mock = new Mock<IGobbler>();
mock.Setup(m => m.Gobble(ref It.Ref<int>.IsAny)) // match any value passed by-ref
.Callback(new GobbleCallback((ref int amount) =>
{
if (amount > 0)
{
Console.WriteLine("Gobbling...");
amount -= 1;
}
}))
.Returns(new GobbleReturns((ref int amount) => amount > 0));
int a = 5;
bool gobbleSomeMore = true;
while (gobbleSomeMore)
{
gobbleSomeMore = mock.Object.Gobble(ref a);
}
Предполагается, что первый столбец (со значениями R1
, R2
и т. Д.) Имеет имя row
(вы не говорите):
select row, 'Not present in table 2' as difference
from table_1
where row not in (select row from table_2)
union all
select row, 'Not present in table 1'
from table_2
where row not in (select row from table_1)
union all
select
t1.row,
concat(
case when t1.c1 <> t2.c1 then 'c1 ' end,
case when t1.c2 <> t2.c2 then 'c2 ' end,
case when t1.c3 <> t2.c3 then 'c3 ' end,
case when t1.c4 <> t2.c4 then 'c4 ' end,
case when t1.c5 <> t2.c5 then 'c5 ' end
)
from table_1 t1
join table_2 t2 on t1.row = t2.row
where t1.c1 <> t2.c1
or t1.c2 <> t2.c2
or t1.c3 <> t2.c3
or t1.c4 <> t2.c4
or t1.c5 <> t2.c5