static void Main(string[] args) { Joey joey = new Joey(); Karl malone = new Karl(); Larry bird = new Larry(); Magic johnson = new Magic(); Michael jordan = new Michael(); Patrick ewing = new Patrick(); List <IDreamteam> serverSide = new List <IDreamteam>(); serverSide.Add(joey); serverSide.Add(malone); serverSide.Add(bird); List <IDreamteam> clientSide = new List <IDreamteam>(); clientSide.Add(johnson); clientSide.Add(jordan); clientSide.Add(ewing); foreach (var server in serverSide) { server.work(); } foreach (var client in clientSide) { client.work(); } }
public void GetService_can_be_accessed_from_multiple_threads_concurrently() { for (var i = 0; i < 30; i++) { var bag = new ConcurrentBag<IPilkington>(); var karl = new Karl(); var resolver = new TransientDependencyResolver<IPilkington>(() => karl, "Karl"); ExecuteInParallel(() => bag.Add(resolver.GetService<IPilkington>("Karl"))); Assert.Equal(20, bag.Count); Assert.True(bag.All(c => karl == c)); } }
public void GetService_can_be_accessed_from_multiple_threads_concurrently() { for (var i = 0; i < 30; i++) { var bag = new ConcurrentBag <IPilkington>(); var karl = new Karl(); var resolver = new TransientDependencyResolver <IPilkington>(() => karl, "Karl"); ExecuteInParallel(() => bag.Add(resolver.GetService <IPilkington>("Karl"))); Assert.Equal(20, bag.Count); Assert.True(bag.All(c => karl == c)); } }
public void GetServices_and_Add_can_be_accessed_from_multiple_threads_concurrently() { for (var i = 0; i < 30; i++) { var bag = new ConcurrentBag <IPilkington>(); var resolver = new ResolverChain(); var karl = new Karl(); ExecuteInParallel( () => { resolver.Add(new SingletonDependencyResolver <IPilkington>(karl, "Karl")); resolver.GetServices <IPilkington>("Karl").Each(bag.Add); }); Assert.True(bag.Count >= 20); Assert.True(bag.All(c => karl == c)); } }
public FileNotIncluded(Karl.Fs.File info) : base(string.Format("The file `{0}' is not included by the project.", info.FullName)) { }
public DirectoryNotIncluded(Karl.Fs.Directory info) : base(string.Format("The directory `{0}' is not included by the project.", info.FullName)) { }