public void ThrowsExceptionIfFailsToLoadData() { var logger = Substitute.For <ILogger>(); var loader = CreateDataLoader(logger, new Timetable.Data()); var services = Substitute.For <IServiceCollection>(); var setData = new SetData(loader, logger); Assert.Throws <InvalidDataException>(() => setData.ConfigureServices(services)); }
public void HasLoadedData() { var logger = Substitute.For <ILogger>(); var loader = CreateDataLoader(logger); var services = Substitute.For <IServiceCollection>(); var setData = new SetData(loader, logger); setData.HasLoadedData.Should().BeFalse(); setData.ConfigureServices(services); setData.HasLoadedData.Should().BeTrue(); }
private List <ServiceDescriptor> ConfigureServices() { var descriptors = new List <ServiceDescriptor>(); var logger = Substitute.For <ILogger>(); var loader = CreateDataLoader(logger); var services = Substitute.For <IServiceCollection>(); services.When(s => s.Add(Arg.Any <ServiceDescriptor>())) .Do(args => descriptors.Add(args[0] as ServiceDescriptor)); var setData = new SetData(loader, logger); setData.ConfigureServices(services); return(descriptors); }