mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-04-22 06:22:50 +08:00
test should be at least once
This commit is contained in:
parent
5ed8257a58
commit
a2c7fda4c9
@ -70,7 +70,7 @@ namespace Ocelot.UnitTests.Configuration
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.Given(x => WhenTheConfigIsChangedInConsul(newConfig, 0))
|
this.Given(x => WhenTheConfigIsChangedInConsul(newConfig, 0))
|
||||||
.Then(x => ThenTheSetterIsCalled(newConfig, 1))
|
.Then(x => ThenTheSetterIsCalledAtLeast(newConfig, 1))
|
||||||
.BDDfy();
|
.BDDfy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,5 +154,21 @@ namespace Ocelot.UnitTests.Configuration
|
|||||||
});
|
});
|
||||||
result.ShouldBeTrue();
|
result.ShouldBeTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ThenTheSetterIsCalledAtLeast(FileConfiguration fileConfig, int times)
|
||||||
|
{
|
||||||
|
var result = WaitFor(2000).Until(() => {
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_setter.Verify(x => x.Set(fileConfig), Times.AtLeast(times));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch(Exception)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
result.ShouldBeTrue();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user