Exemple #1
0
        /// <summary>
        /// Ack() will be called when the transaction is committed.
        /// </summary>
        /// <param name="seqId">Sequence Id of the tuple which is acked.</param>
        /// <param name="parms"></param>
        public void Ack(long seqId, Dictionary <string, Object> parms)
        {
            Context.Logger.Info("Ack, seqId: {0}", seqId);
            State state = stateStore.GetState(seqId);

            state.Commit(true);
        }
Exemple #2
0
        public void ItWorksWithoutUnregisteredController()
        {
            var store = new StateStore();

            Assert.Throws <KeyNotFoundException>(() => {
                store.GetState <float>("NonExistingController");
            });
        }
Exemple #3
0
        public void Ack(long seqId, Dictionary <string, Object> parms)
        {
            Context.Logger.Info("Ack, seqId: {0}", seqId);

            if (Context.pluginType != SCPPluginType.SCP_NET_LOCAL)
            {
                State state = stateStore.GetState(seqId);
                state.Commit(true);
            }
        }
Exemple #4
0
        public void ItRegistersStateControllers()
        {
            var store      = new StateStore();
            var controller = new CurrentHealthController();

            store.AddController("CurrentHealth", controller);

            var currentHealth = store.GetState <float>("CurrentHealth");

            Assert.AreEqual(currentHealth, controller.GetState());
        }
Exemple #5
0
        public void AllIsWell()
        {
            var store = new StateStore();

            store.AddController("CurrentHealth", new CurrentHealthController());

            store.Dispatch(new StoreAction {
                Type    = "UpdateCurrentHealth",
                Payload = 20f
            });

            Assert.AreEqual(store.GetState <float>("CurrentHealth"), 20f);
        }