Beispiel #1
0
        public SwarmTest(ITestOutputHelper output)
        {
            Log.Logger = new LoggerConfiguration()
                         .MinimumLevel.Debug()
                         .Enrich.WithThreadId()
                         .WriteTo.TestOutput(output, outputTemplate: "{Timestamp:HH:mm:ss}[@{SwarmId}][{ThreadId}] - {Message}")
                         .CreateLogger()
                         .ForContext <SwarmTest>();

            var policy = new BlockPolicy <BaseAction>();

            _fx1 = new FileStoreFixture();
            _fx2 = new FileStoreFixture();
            _fx3 = new FileStoreFixture();

            _blockchains = new List <BlockChain <BaseAction> >
            {
                new BlockChain <BaseAction>(policy, _fx1.Store),
                new BlockChain <BaseAction>(policy, _fx2.Store),
                new BlockChain <BaseAction>(policy, _fx3.Store),
            };

            _swarms = new List <Swarm>
            {
                new Swarm(
                    new PrivateKey(),
                    ipAddress: IPAddress.Loopback),
                new Swarm(
                    new PrivateKey(),
                    ipAddress: IPAddress.Loopback),
                new Swarm(
                    new PrivateKey(),
                    ipAddress: IPAddress.Loopback),
            };
        }
Beispiel #2
0
 public BlockChainTest()
 {
     _fx         = new FileStoreFixture();
     _blockChain = new BlockChain <BaseAction>(
         new BlockPolicy <BaseAction>(),
         _fx.Store
         );
 }
Beispiel #3
0
 public MineBlock()
 {
     _fx         = new FileStoreFixture();
     _blockChain = new BlockChain <DumbAction>(
         new NullPolicy <DumbAction>(),
         _fx.Store
         );
 }
Beispiel #4
0
        public SwarmTest(ITestOutputHelper output)
        {
            const string outputTemplate =
                "{Timestamp:HH:mm:ss}[@{SwarmId}][{ThreadId}] - {Message}";

            Log.Logger = new LoggerConfiguration()
                         .MinimumLevel.Debug()
                         .Enrich.WithThreadId()
                         .WriteTo.TestOutput(output, outputTemplate: outputTemplate)
                         .CreateLogger()
                         .ForContext <SwarmTest>();

            _output = output;

            var policy = new BlockPolicy <DumbAction>(new MinerReward(1));

            _fx1 = new FileStoreFixture();
            _fx2 = new FileStoreFixture();
            _fx3 = new FileStoreFixture();

            _blockchains = new List <BlockChain <DumbAction> >
            {
                new BlockChain <DumbAction>(policy, _fx1.Store),
                new BlockChain <DumbAction>(policy, _fx2.Store),
                new BlockChain <DumbAction>(policy, _fx3.Store),
            };

            _swarms = new List <Swarm <DumbAction> >
            {
                new Swarm <DumbAction>(
                    _blockchains[0],
                    new PrivateKey(),
                    appProtocolVersion: 1,
                    host: IPAddress.Loopback.ToString()),
                new Swarm <DumbAction>(
                    _blockchains[1],
                    new PrivateKey(),
                    appProtocolVersion: 1,
                    host: IPAddress.Loopback.ToString()),
                new Swarm <DumbAction>(
                    _blockchains[2],
                    new PrivateKey(),
                    appProtocolVersion: 1,
                    host: IPAddress.Loopback.ToString()),
            };
        }
Beispiel #5
0
        public SwarmTest(ITestOutputHelper output)
        {
            Log.Logger = new LoggerConfiguration()
                         .MinimumLevel.Verbose()
                         .Enrich.WithThreadId()
                         .WriteTo.TestOutput(output, outputTemplate: "{Timestamp:HH:mm:ss}[@{Swarm_listenUrl}][{ThreadId}] - {Message}")
                         .CreateLogger()
                         .ForContext <SwarmTest>();

            var policy = new BlockPolicy <BaseAction>();

            _fx1 = new FileStoreFixture();
            _fx2 = new FileStoreFixture();
            _fx3 = new FileStoreFixture();

            _blockchains = new List <BlockChain <BaseAction> >
            {
                new BlockChain <BaseAction>(policy, _fx1.Store),
                new BlockChain <BaseAction>(policy, _fx2.Store),
                new BlockChain <BaseAction>(policy, _fx3.Store),
            };

            _swarms = new List <Swarm>
            {
                new Swarm(
                    new PrivateKey(),
                    new Uri($"inproc://swarmtest.a"),
                    3000),
                new Swarm(
                    new PrivateKey(),
                    new Uri($"inproc://swarmtest.b"),
                    3000),
                new Swarm(
                    new PrivateKey(),
                    new Uri($"inproc://swarmtest.c"),
                    3000),
            };
        }
Beispiel #6
0
 public BlockchainTest()
 {
     _fx         = new FileStoreFixture();
     _blockchain = new Blockchain <BaseAction>(_fx.Store);
 }