コード例 #1
0
        public void Accept_AcceptsNoLabelNoTagsServiceBinding()
        {
            var s = new Service()
            {
                Label       = string.Empty,
                Tags        = System.Array.Empty <string>(),
                Name        = "mongoService",
                Plan        = "free",
                Credentials = new Credential()
                {
                    { "hostname", new Credential("192.168.0.90") },
                    { "port", new Credential("27017") },
                    { "name", new Credential("cf_b4f8d2fa_a3ea_4e3a_a0e8_2cd040790355") },
                    { "username", new Credential("Dd6O1BPXUHdrmzbP") },
                    { "password", new Credential("7E1LxXnlH2hhlPVt") },
                    { "uri", new Credential("mongodb://*****:*****@192.168.0.90:27017/cf_b4f8d2fa_a3ea_4e3a_a0e8_2cd040790355?reconnect=true") },
                }
            };
            var factory = new MongoDbServiceInfoFactory();

            Assert.True(factory.Accept(s));
        }
コード例 #2
0
        public void Accept_AcceptsValidServiceBinding()
        {
            Service s = new Service()
            {
                Label       = "p-mongodb",
                Tags        = new string[] { "mongodb" },
                Name        = "mongoService",
                Plan        = "free",
                Credentials = new Credential()
                {
                    { "hostname", new Credential("192.168.0.90") },
                    { "port", new Credential("27017") },
                    { "name", new Credential("cf_b4f8d2fa_a3ea_4e3a_a0e8_2cd040790355") },
                    { "username", new Credential("Dd6O1BPXUHdrmzbP") },
                    { "password", new Credential("7E1LxXnlH2hhlPVt") },
                    { "uri", new Credential("mongodb://*****:*****@192.168.0.90:27017/cf_b4f8d2fa_a3ea_4e3a_a0e8_2cd040790355?reconnect=true") },
                }
            };
            MongoDbServiceInfoFactory factory = new MongoDbServiceInfoFactory();

            Assert.True(factory.Accept(s));
        }
コード例 #3
0
        public void Accept_RejectsInvalidServiceBinding()
        {
            var s = new Service()
            {
                Label       = "p-mysql",
                Tags        = new string[] { "foobar", "relational" },
                Name        = "mySqlService",
                Plan        = "100mb-dev",
                Credentials = new Credential()
                {
                    { "hostname", new Credential("192.168.0.90") },
                    { "port", new Credential("27017") },
                    { "name", new Credential("cf_b4f8d2fa_a3ea_4e3a_a0e8_2cd040790355") },
                    { "username", new Credential("Dd6O1BPXUHdrmzbP") },
                    { "password", new Credential("7E1LxXnlH2hhlPVt") },
                    { "uri", new Credential("mysql://*****:*****@192.168.0.90:27017/cf_b4f8d2fa_a3ea_4e3a_a0e8_2cd040790355?reconnect=true") },
                    { "jdbcUrl", new Credential("jdbc:mysql://192.168.0.90:27017/cf_b4f8d2fa_a3ea_4e3a_a0e8_2cd040790355?user=Dd6O1BPXUHdrmzbP&password=7E1LxXnlH2hhlPVt") }
                }
            };
            var factory = new MongoDbServiceInfoFactory();

            Assert.False(factory.Accept(s));
        }