public void Init()
        {
            var root   = "rootpath";
            var config = new XDoc("config")
                         .Start("storage")
                         .Attr("type", "s3")
                         .Elem("root", root)
                         .Elem("bucket", "bucket")
                         .Elem("privatekey", "private")
                         .Elem("publickey", "public")
                         .End();
            var builder = new ContainerBuilder();

            builder.Register((c, p) => {
                var s3Config = p.TypedAs <AmazonS3ClientConfig>();
                Assert.AreEqual(root, s3Config.RootPath);
                Assert.AreEqual("http://s3.amazonaws.com", s3Config.S3BaseUri.ToString());
                Assert.AreEqual("bucket", s3Config.Bucket);
                Assert.AreEqual("private", s3Config.PrivateKey);
                Assert.AreEqual("public", s3Config.PublicKey);
                Assert.IsNull(_s3ClientMock, "storage already resolved");
                _clientProxy = new AmazonS3ClientProxy();
                return(_clientProxy);
            }).As <IAmazonS3Client>().ServiceScoped();
            _hostInfo = DreamTestHelper.CreateRandomPortHost(config, builder.Build());
        }
예제 #2
0
 public void Init()
 {
     var root = "rootpath";
     var config = new XDoc("config")
         .Start("storage")
             .Attr("type", "s3")
             .Elem("root", root)
             .Elem("bucket", "bucket")
             .Elem("privatekey", "private")
             .Elem("publickey", "public")
         .End();
     var builder = new ContainerBuilder();
     builder.Register((c, p) => {
         var s3Config = p.TypedAs<AmazonS3ClientConfig>();
         Assert.AreEqual(root, s3Config.RootPath);
         Assert.AreEqual("http://s3.amazonaws.com", s3Config.S3BaseUri.ToString());
         Assert.AreEqual("bucket", s3Config.Bucket);
         Assert.AreEqual("private", s3Config.PrivateKey);
         Assert.AreEqual("public", s3Config.PublicKey);
         Assert.IsNull(_s3ClientMock, "storage already resolved");
         _clientProxy = new AmazonS3ClientProxy();
         return _clientProxy;
     }).As<IAmazonS3Client>().ServiceScoped();
     _hostInfo = DreamTestHelper.CreateRandomPortHost(config, builder.Build());
 }