コード例 #1
0
ファイル: ClientTests.cs プロジェクト: Zazcallabah/PokeSave
        public void ClientCanExcecuteCommands()
        {
            var commands = new[] { new Command{
                Trigger = "makeown",
                Actions = new []
                {
                    "r pcbuffer[0].originaltrainerid",
                    "w team[1].originaltrainerid {}",
                    "r pcbuffer[0].gameoforigin",
                    "w team[1].gameoforigin {}",
                    "r pcbuffer[0].originaltrainergender",
                    "w team[1].originaltrainergender {}",
                    "r pcbuffer[0].originaltrainername",
                    "w team[1].originaltrainername {}"
                }
            } };
            _c = new SimpleCommandLineClient( new InjectionQueueCommunicator( _com ), new CommandHandler( commands ) );
            var sf = new SaveFile( "p2.sav" );
            Assert.AreNotEqual( sf.Latest.PcBuffer[0].OriginalTrainerName, sf.Latest.Team[1].OriginalTrainerName );
            Assert.AreNotEqual( sf.Latest.PcBuffer[0].OriginalTrainerGender, sf.Latest.Team[1].OriginalTrainerGender );
            Assert.AreNotEqual( sf.Latest.PcBuffer[0].OriginalTrainerId, sf.Latest.Team[1].OriginalTrainerId );
            Assert.AreNotEqual( sf.Latest.PcBuffer[0].GameOfOrigin, sf.Latest.Team[1].GameOfOrigin );

            Load( new[] { "ld p2.sav", "c makeown", "st " + Outfile, "q" } );
            _c.Run( null );
            var sf2 = new SaveFile( Outfile );
            Assert.AreEqual( sf2.Latest.PcBuffer[0].OriginalTrainerName, sf2.Latest.Team[1].OriginalTrainerName );
            Assert.AreEqual( sf2.Latest.PcBuffer[0].OriginalTrainerGender, sf2.Latest.Team[1].OriginalTrainerGender );
            Assert.AreEqual( sf2.Latest.PcBuffer[0].OriginalTrainerId, sf2.Latest.Team[1].OriginalTrainerId );
            Assert.AreEqual( sf2.Latest.PcBuffer[0].GameOfOrigin, sf2.Latest.Team[1].GameOfOrigin );
        }
コード例 #2
0
ファイル: ClientTests.cs プロジェクト: Zazcallabah/PokeSave
 public void Setup()
 {
     _com = new TestComms();
     _c = new SimpleCommandLineClient( new InjectionQueueCommunicator( _com ), "test.json" );
     if( File.Exists( Outfile ) )
         File.Delete( Outfile );
 }