using Autofac; using Aurora.Proto.Party; using Aurora.Services.Server; using Aurora.Services.Library; using Aurora.Services.Settings; using Aurora.Services.EventManager; using Aurora.test.Models.Mock; using System.IO; using Grpc.Core; namespace Aurora.test.ControllerTests { public class SetupUtil { public static IContainer SetupOneTime() { ContainerBuilder builder = new ContainerBuilder(); builder.RegisterType().As().SingleInstance(); builder.RegisterInstance(new SettingsServiceMock() { Username = "Test User 1", DefaultPort = 4005, LibraryLocation = string.Format("{0}/Resources", Directory.GetCurrentDirectory()) }).SingleInstance(); builder.RegisterType().As().SingleInstance(); builder.RegisterType().As().SingleInstance(); return builder.Build(); } public static RemotePartyService.RemotePartyServiceClient Setup(ref IContainer container, ref IServerService serverService, ref Channel channel) { serverService = container.Resolve(); serverService.Start("testParty", "asdf"); channel = new Channel(string.Format("{0}:{1}", ServerService.GetLocalIPAddress(), 8080), ChannelCredentials.Insecure); return new RemotePartyService.RemotePartyServiceClient(channel); } } }