public void ReflectionVirtualMachineFeature_OnInitialize_RulesAdded()
        {
            Network network = KnownNetworks.StratisRegTest;

            var chain           = new ConcurrentChain(network);
            var contractState   = new StateRepositoryRoot();
            var executorFactory = new Mock <IContractExecutorFactory>();
            var loggerFactory   = new ExtendedLoggerFactory();

            var dateTimeProvider = new DateTimeProvider();

            var consensusRules = new SmartContractPowConsensusRuleEngine(
                chain, new Mock <ICheckpoints>().Object, new Configuration.Settings.ConsensusSettings(),
                DateTimeProvider.Default, executorFactory.Object, loggerFactory, network,
                new Base.Deployments.NodeDeployments(network, chain), contractState,
                new Mock <IReceiptRepository>().Object,
                new Mock <ISenderRetriever>().Object,
                new Mock <ICoinView>().Object,
                new Mock <IChainState>().Object,
                new InvalidBlockHashStore(dateTimeProvider),
                new NodeStats(dateTimeProvider));

            var feature = new ReflectionVirtualMachineFeature(loggerFactory, network);

            feature.InitializeAsync().GetAwaiter().GetResult();

            Assert.Single(network.Consensus.FullValidationRules.Where(r => r.GetType() == typeof(SmartContractFormatRule)));
        }
예제 #2
0
        public void ReflectionVirtualMachineFeature_OnInitialize_RulesAdded()
        {
            Network network = KnownNetworks.StratisRegTest;

            var loggerFactory      = new ExtendedLoggerFactory();
            var callDataSerializer = Mock.Of <ICallDataSerializer>();

            var feature = new ReflectionVirtualMachineFeature(loggerFactory, network, callDataSerializer);

            feature.InitializeAsync().GetAwaiter().GetResult();

            Assert.Single(network.Consensus.FullValidationRules.Where(r => r.GetType() == typeof(SmartContractFormatRule)));
        }