Ejemplo n.º 1
0
        public void Run_Turn_Calculation()
        {
            /// Initialise
            var log     = new EmptyLog();
            var locator = new InMemoryLocator();

            locator.AddResolver(typeof(IRepository <Stockpile>), () => new InMemoryRepository <Stockpile>());
            var bus = new InMemoryBus(locator, log);

            Bus.SetBus(bus);
            Bus.RegisterHandler <AddStockpileCommandHandler>();

            /// Start testing
            var calculator = new TurnCalculator();

            var map  = new Map(8, 8);
            var game = new Game(map.GetAggregateKey());

            var stockpileRepository = new InMemoryRepository <Stockpile>();

            Bus.Send(new AddStockpileCommand(game, Resource.Collection.Iron));
            Bus.Send(new AddStockpileCommand(game, Resource.Collection.Stone));
            Bus.Send(new AddStockpileCommand(game, Resource.Collection.Wood));

            calculator.Calculate(game);
        }
Ejemplo n.º 2
0
        public void CppCheckConverter_HandlesEmptyErrorsElement()
        {
            const string source = "<results> <cppcheck version=\"12.34\" /> <errors>   </errors> </results>";

            SarifLog emptyLog = EmptyLog.DeepClone();

            emptyLog.Runs[0].Tool.Driver.Version = "12.34.0";
            RunTestCase(source, JsonConvert.SerializeObject(emptyLog));
        }
Ejemplo n.º 3
0
        public static void Configure()
        {
            IServiceLocator locator = new SimpleResolver();

            ILog <InMemoryBus> log = new EmptyLog <InMemoryBus>();

            var bus = new InMemoryBus(locator, log);//container.Resolve<IBus>();

            Bus.SetBus(bus);

            BusConfig.RegisterHandlers();
        }
Ejemplo n.º 4
0
        public Startup(IHostingEnvironment env)
        {
            Configuration = new ConfigurationBuilder()
                            .SetBasePath(env.ContentRootPath)
                            .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                            .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
                            .AddEnvironmentVariables()
                            .Build();

            var log = new EmptyLog();

            Container = new AspNetCoreContainer(log);
        }
        public void DracoonClient_Ctor()
        {
            // ARRANGE
            Uri               expectedUri  = new Uri("https://dracoon.team");
            DracoonAuth       expectedAuth = new DracoonAuth("token");
            string            expectedEncryptionPassword = "******";
            EmptyLog          expectedLog    = new EmptyLog();
            DracoonHttpConfig expectedConfig = new DracoonHttpConfig(true);

            Mock.Arrange(() => Arg.IsAny <Uri>().MustBeValid(Arg.AnyString)).DoNothing().Occurs(1);

            // ACT
            DracoonClient          dc         = new DracoonClient(expectedUri, null, expectedEncryptionPassword, expectedLog, expectedConfig);
            IInternalDracoonClient dcInternal = dc;

            // ASSERT
            Assert.Equal(expectedUri, dc.ServerUri);
            Assert.Null(dc.Auth);
            dc.Auth = expectedAuth;
            Assert.Equal(expectedAuth, dc.Auth);
            Assert.Equal(expectedEncryptionPassword, dc.EncryptionPassword);
            Assert.Equal(expectedConfig, DracoonClient.HttpConfig);
            Assert.Equal(expectedLog, DracoonClient.Log);
            Assert.NotNull(dc.Nodes);
            Assert.NotNull(dc.Account);
            Assert.NotNull(dc.Server);
            Assert.NotNull(dc.Shares);
            Assert.NotNull(dc.Users);
            Assert.NotNull(dcInternal.Executor);
            Assert.NotNull(dcInternal.Builder);
            Assert.NotNull(dcInternal.OAuth);
            Assert.NotNull(dcInternal.NodesImpl);
            Assert.NotNull(dcInternal.AccountImpl);
            Assert.NotNull(dcInternal.ServerImpl);
            Assert.NotNull(dcInternal.SharesImpl);
            Assert.NotNull(dcInternal.UsersImpl);
            Mock.Assert(() => Arg.IsAny <Uri>().MustBeValid(Arg.AnyString));
        }
Ejemplo n.º 6
0
 internal static void ClearLogOutput(Plugin source) => EmptyLog?.Invoke(source, new LogEventArgs(source, default(LogEntry)));