mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 21:10:49 +08:00 
			
		
		
		
	test should be at least once
This commit is contained in:
		@@ -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();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user