コード例 #1
0
        public void FindsUpdatedCharacter()
        {
            GameState     state     = Factory.DefaultGameState;
            Character     character = state.Party[0];
            PartyResolver resolver  = new PartyResolver(character, state);

            state = state.WithParty(state.Party.ReplaceWithID(character.WithCT(Time.ActionAmount)));
            resolver.Update(state);

            Assert.Equal(Time.ActionAmount, resolver.Item.CT);
        }
コード例 #2
0
        public void ThrowsWhenStale()
        {
            GameState  state  = Factory.DefaultGameState;
            GameEngine engine = Factory.CreateDefaultGameEngine(state);

            PartyResolver resolver = new PartyResolver(state.Party[0], state);

            engine.Process();

            Assert.Throws <StaleReferenceException> (() => resolver.Item);
        }
        /// <summary>
        /// this function is used as the callback function for the EndOfStream delegate provided in PartyResolutionStream class
        /// This function gets called after the entire stream of the message has been read, guaranteeing that all promoted properties
        /// from the message have been populated to the message context.
        /// </summary>
        internal void EndOfStream()
        {
            string       SourceDomain = null;
            BizTalkParty party;

            //obtain the SourceOrg string from the message
            SourceDomain = (string)mBaseMessage.Context.Read("SourceDomain", "http://CustomPartyResolution_Pipeline.RoutingPropertySchema");

            if (SourceDomain != null)
            {
                PartyResolver pr = new PartyResolver();
                party = pr.GetPartyFromAlias("Domain", "DomainName", SourceDomain);

                mBaseMessage.Context.Write("SourcePartyID", "http://schemas.microsoft.com/BizTalk/2003/system-properties", party.SID);
                mBaseMessage.Context.Write("PartyName", "http://schemas.microsoft.com/BizTalk/2003/messagetracking-properties", party.Name);
            }
        }