public void ShouldThrowExeptionWhenSourceListIsNull() { var carListProvider = new NullCarListProvider(); var itemUnderTest = new RandomObjectProvider <Car>(carListProvider); Assert.Throws <InvalidOperationException>(() => { itemUnderTest.Fetch(); }); }
public void ShouldReturnItemFromCarListProvider() { // Arrange var carListProvider = new CarListProvider(); var sourceList = carListProvider.Fetch(); var itemUnderTest = new RandomObjectProvider <Car>(carListProvider); // Act var result = itemUnderTest.Fetch(); // Assert result.ShouldNotBeNull(); result.ShouldBeOneOf(sourceList.ToArray()); }