コード例 #1
0
 public void GlobalSetup()
 {
     builder = new RelationalLockBuilder();
     baseCfg = new RelationalLockConfigurator();
     baseCfg.RegisterRelation("key1", "key2", "key3");
     baseCfg.RegisterRelation("key2", "key4");
 }
コード例 #2
0
        public RelationalLockConfigurator Get3Key2RelConfigurator()
        {
            var cfg = new RelationalLockConfigurator();

            cfg.RegisterRelation("key1", "key2");
            cfg.RegisterRelation("key2", "key3");
            return(cfg);
        }
コード例 #3
0
        public void GlobalSetup()
        {
            var builder = new RelationalLockBuilder();
            var cfg     = new RelationalLockConfigurator();

            cfg.RegisterRelation("key1", "key2");
            cfg.RegisterRelation("key2", "key3");
            cfg.RegisterRelation("key3", "key4");
            cfg.RegisterRelation("key4", "key5");
            cfg.RegisterRelation("key5", "key1");
            manager = builder.Build(cfg);
        }
コード例 #4
0
        public void SuccessTest()
        {
            IRelationalLockManager manager = default;

            "初期化"
            .x(() => {
                configurator.RegisterRelation("key1", "key3", "key2");
                configurator.RegisterRelation("key2", "key4");
                manager = builder.Build(configurator);
            });
            "nullでないこと"
            .x(() => manager.Should().NotBeNull());
            "有効なキーがリレーションを追加したキーの昇順であること"
            .x(() => manager.AvailableKeys.Should().Equal("key1", "key2", "key3", "key4"));
        }
コード例 #5
0
 public void ExceptionScenarios()
 {
     "キー配列が空"
     .x(() => new Action(() => cfg.RegisterRelation(null)).Should().Throw <ArgumentNullException>());
     "キーが空"
     .x(() => new Action(() => cfg.RegisterRelation()).Should().Throw <ArgumentException>());
     "キーが1つ"
     .x(() => new Action(() => cfg.RegisterRelation("key1")).Should().Throw <ArgumentException>());
     "1つ目のキーがnull"
     .x(() => new Action(() => cfg.RegisterRelation(null, "key2")).Should().Throw <ArgumentException>());
     "1つ目のキーが空文字"
     .x(() => new Action(() => cfg.RegisterRelation("", "key2", "key3")).Should().Throw <ArgumentException>());
     "2つ目のキーがnull"
     .x(() => new Action(() => cfg.RegisterRelation("key1", null, "key3")).Should().Throw <ArgumentException>());
     "2つ目のキーが空文字"
     .x(() => new Action(() => cfg.RegisterRelation("key1", "")).Should().Throw <ArgumentException>());
     "同じキーが含まれる"
     .x(() => new Action(() => cfg.RegisterRelation("key1", "key2", "key1")).Should().Throw <ArgumentException>());
     "例外の時は登録されない"
     .x(() => cfg.RelationCount.Should().Be(0));
     "登録なしで情報取得しようとする"
     .x(() => new Action(() => cfg.GetInfos()).Should().Throw <InvalidOperationException>());
 }