public async Task Create_DoesNotReturnNull() { var factory = new LambdaFactory(); var result = await factory.Create(); Assert.That(result, Is.Not.EqualTo(null)); }
private Certificate CreateInstance( out AcmFactory acmFactory, out Route53Factory route53Factory, out LambdaFactory lambdaFactory, Certificate.Properties?props = null, IAmazonCertificateManager?acmClient = null, IAmazonRoute53?route53Client = null, IAmazonLambda?lambdaClient = null, string?functionName = null) { var certificate = new Certificate { PhysicalResourceId = ARN, Request = new Request <Certificate.Properties> { PhysicalResourceId = ARN, ResourceProperties = props ?? DEFAULT_PROPS }, }; route53Factory = CreateRoute53Factory(route53Client); acmFactory = CreateAcmFactory(acmClient); lambdaFactory = CreateLambdaFactory(lambdaClient); var context = Substitute.For <ILambdaContext>(); context.FunctionName.Returns(functionName ?? FUNCTION_NAME); SetReadonlyField(certificate, "Context", context); SetPrivateField(certificate, "route53Factory", route53Factory); SetPrivateField(certificate, "acmFactory", acmFactory); SetPrivateField(certificate, "lambdaFactory", lambdaFactory); return(certificate); }
public static IDatabaseRepository <IHarvesterDataContext> CreateHarvesterRepository(RepositoryArgumentsBase arguments) { if (arguments.GetType() == typeof(SqlServerDatabaseRepositoryArguments)) { LambdaFactory <IHarvesterDataContext, String> contextFactory = LambdaFactory.Wrap <IHarvesterDataContext, String>(s => new HarvesterDataContext(s)); return(new SqlServerDatabaseRepository <IHarvesterDataContext>(arguments as SqlServerDatabaseRepositoryArguments, contextFactory)); } throw new NotImplementedException(); }
public static IDatabaseRepository <IStatisticsDataContext> CreateStatisticsRepository(RepositoryArgumentsBase arguments) { if (arguments is SqlServerDatabaseRepositoryArguments repositoryArguments) { LambdaFactory <IStatisticsDataContext, String> contextFactory = LambdaFactory.Wrap <IStatisticsDataContext, String>(s => new StatisticsDataContext(s)); return(new SqlServerDatabaseRepository <IStatisticsDataContext>(repositoryArguments, contextFactory)); } throw new NotImplementedException(); }
public IScopeSyntax ToMethod <TTo>(Func <TTo> p) where TTo : TFrom { var typeFactory = new LambdaFactory(c => p()); var componentFactory = new ComponentFactory { Factory = typeFactory }; this.kernel.Bind(typeof(TFrom), componentFactory); return(new ScopeSyntax(componentFactory)); }
public static ICounterRepository CreateCounterRepository(RepositoryArgumentsBase arguments) { switch (arguments) { case SushiCounterRepositoryArguments repositoryArguments: { BasicHttpBinding binding = new BasicHttpBinding { MaxBufferPoolSize = Int32.MaxValue, MaxBufferSize = Int32.MaxValue, MaxReceivedMessageSize = Int32.MaxValue, SendTimeout = new TimeSpan(0, 6, 0), ReceiveTimeout = new TimeSpan(0, 6, 0) }; LambdaFactory <ISushiServiceInterfaceClient, EndpointAddress> factory; switch (repositoryArguments.Version) { case "3.0": case "3": factory = new LambdaFactory <ISushiServiceInterfaceClient, EndpointAddress>(address => new Journal.Sushi_3_0.SushiServiceInterfaceClient(binding, address)); break; case "4.0": case "4": factory = new LambdaFactory <ISushiServiceInterfaceClient, EndpointAddress>(address => new Journal.Sushi_4_0.SushiServiceInterfaceClient(binding, address)); break; case "4.1": case "": case null: factory = new LambdaFactory <ISushiServiceInterfaceClient, EndpointAddress>(address => new SushiServiceInterfaceClient(binding, address)); break; default: throw new NotImplementedException(@"Sushi Version is not supported: {repositoryArguments.Version}. Try 4.1"); } return(new SushiCounterRepository(repositoryArguments, factory)); } case EbscoHostCounterRepositoryArguments ebscoRepositoryArguments: { BasicHttpBinding binding = new BasicHttpBinding { MaxBufferPoolSize = Int32.MaxValue, MaxBufferSize = Int32.MaxValue, MaxReceivedMessageSize = Int32.MaxValue, SendTimeout = new TimeSpan(0, 6, 0), ReceiveTimeout = new TimeSpan(0, 6, 0), }; var sushiFactory = new LambdaFactory <ISushiServiceInterfaceClient, EndpointAddress>(address => new SushiServiceInterfaceClient(binding, address)); var sushiRepoFactory = LambdaFactory.Wrap <SushiCounterRepository, SushiCounterRepositoryArguments>(s => new SushiCounterRepository(s, sushiFactory)); return(new EbscoHostCounterRepository(ebscoRepositoryArguments, sushiRepoFactory)); } case EmailRepositoryArguments emailRepositoryArguments: return(new EmailRepository(emailRepositoryArguments)); case SushiMuseCounterRepositoryArguments sushiArgs: { SushiCounterRepositoryArguments counterArgumentsnew = SushiCounterRepositoryArguments(sushiArgs); CustomBinding binding = new CustomBinding( new CustomTextMessageBindingElement("iso-8859-1", "text/xml", MessageVersion.Soap11), new HttpTransportBindingElement()); var factory = new LambdaFactory <ISushiServiceInterfaceClient, EndpointAddress>(address => new Journal.Sushi_3_0.SushiServiceInterfaceClient(binding, address)); return(new SushiCounterRepository(counterArgumentsnew, factory)); } case SushiMpsCounterRepositoryArguments sushiArgs: { SushiCounterRepositoryArguments counterArgumentsnew = SushiCounterRepositoryArguments(sushiArgs); BasicHttpBinding binding = new BasicHttpBinding { MaxBufferPoolSize = Int32.MaxValue, MaxBufferSize = Int32.MaxValue, MaxReceivedMessageSize = Int32.MaxValue, SendTimeout = new TimeSpan(0, 6, 0), ReceiveTimeout = new TimeSpan(0, 6, 0), }; var factory = new LambdaFactory <ISushiServiceInterfaceClient, EndpointAddress>(address => new MPSInsight.SushiServiceInterfaceClient(binding, address)); return(new SushiCounterRepository(counterArgumentsnew, factory)); } case SushiGaleCounterRepositoryArguments sushiArgs: { SushiCounterRepositoryArguments counterArgumentsnew = SushiCounterRepositoryArguments(sushiArgs); var binding = new CustomBinding(new BasicHttpBinding("SushiService4")); binding.Elements.Remove <TextMessageEncodingBindingElement>(); binding.Elements.Insert(0, new CustomTextMessageBindingElement(null, "text/html", MessageVersion.Soap11)); var httpTransportBindingElement = binding.Elements.Find <HttpTransportBindingElement>(); httpTransportBindingElement.MaxReceivedMessageSize = Int32.MaxValue; binding.Elements.Remove <HttpTransportBindingElement>(); binding.Elements.Add(httpTransportBindingElement); var factory = new LambdaFactory <ISushiServiceInterfaceClient, EndpointAddress>(address => new Gale.SushiServiceInterfaceClient(binding, address)); return(new SushiCounterRepository(counterArgumentsnew, factory)); } case SushiJstorCounterRepositoryArguments sushiArgs: { SushiCounterRepositoryArguments counterArgumentsnew = SushiCounterRepositoryArguments(sushiArgs); var binding = new CustomBinding(new BasicHttpBinding(BasicHttpSecurityMode.Transport) { MaxReceivedMessageSize = Int32.MaxValue, SendTimeout = TimeSpan.FromMinutes(4) }); binding.Elements.Remove <TextMessageEncodingBindingElement>(); binding.Elements.Insert(0, new CustomTextMessageBindingElement(null, null, MessageVersion.Soap11)); var factory = new LambdaFactory <ISushiServiceInterfaceClient, EndpointAddress>(address => new Journal.Sushi_4_0.SushiServiceInterfaceClient(binding, address)); return(new SushiCounterRepository(counterArgumentsnew, factory)); } default: throw new NotImplementedException(); } }
public AutoRunModuleConfig() { AutoRunDiscoveryServiceFactory = new LambdaFactory <IAutoRunDiscoveryStrategy>( () => new ReflectionAutoRunDiscoveryStrategy(new ForceLoadAssemblyProvider())); }