public void Resolve(IIOCContainer container) { for (var i = 0; i < this.count; i++) { container.Resolve(this.interfaceTypes[this.random.Next(this.numberOfTypes)]); } }
private static IConferenceRoomService SetupChildContext(IIOCContainer child, string organizationId) { child.RegisterInstance <IContextService>(new CustomOrganizationContextService(organizationId, child.Resolve <ITokenProvider>(), child.Resolve <ITokenService>(), child.Resolve <IDeviceRepository>(), child.Resolve <IOrganizationRepository>())); var conferenceRoomService = child.Resolve <IConferenceRoomService>(); return(conferenceRoomService); }
private static void TestSingleton(IIOCContainer container) { var data = new List <string> { "Hermine", "Edward", "Karen", "Ando" }; var watch = System.Diagnostics.Stopwatch.StartNew(); container.SetupForSingletonTest(); for (var i = 0; i < Max; i++) { var obj = container.Resolve <IController>(new { users = data }); } watch.Stop(); var elapsedMs = watch.ElapsedMilliseconds; Console.WriteLine($"Container: {container.Name}, Singleton resolve time: {elapsedMs}ms"); }
private static async Task TestAsyncFunctionCall(IIOCContainer container) { var data = new List <string> { "Hermine", "Edward", "Karen", "Ando" }; var watch = System.Diagnostics.Stopwatch.StartNew(); //transient var obj = container.Resolve <IController>(new { users = data }); for (var i = 0; i < Max / 100; i++) { //async method await obj.SaveUser($"Fredd{i}"); } watch.Stop(); var elapsedMs = watch.ElapsedMilliseconds; Console.WriteLine($"Container: {container.Name}, Async Method Call time: {elapsedMs}ms"); }
private static void TestFunctionCall(IIOCContainer container) { var data = new List <string> { "Hermine", "Edward", "Karen", "Ando" }; var watch = System.Diagnostics.Stopwatch.StartNew(); //transient var obj = container.Resolve <IController>(new { users = data }); for (var i = 0; i < Max; i++) { //ordinary method obj.GetUserById(1); } watch.Stop(); var elapsedMs = watch.ElapsedMilliseconds; Console.WriteLine($"Container: {container.Name}, Ordinary Method Call time: {elapsedMs}ms"); }
public Form1(IIOCContainer container) : this() { _filePathGetter = container.Resolve<IGetFilePath>(); _packageRestoreRemover = container.Resolve<IRemoveNuGetPackageRestore>(); }