test should be at least once

This commit is contained in:
Tom Gardham-Pallister 2018-05-06 18:43:24 +01:00
parent 5ed8257a58
commit a2c7fda4c9

View File

@ -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();
}
} }
} }