public void GetCorrectCredentailStringForAnonymous()
        {
            GhostPanelConfig config = FakeConfig.GetFakeConfig();
            var credProvider        = new SteamCredentialProvider(config);

            Assert.Equal("anonymous", credProvider.GetCredentialString());
        }
        public void GetBaseInstallDirectory()
        {
            GhostPanelConfig config = FakeConfig.GetFakeConfig();
            var provider            = new DefaultDirectoryProvider(config);

            Assert.Equal("C:\\Game Servers", provider.GetBaseInstallDirectory());
        }
        public void GetGameFileDirectory()
        {
            GhostPanelConfig config = FakeConfig.GetFakeConfig();
            var provider            = new DefaultDirectoryProvider(config);

            Assert.Equal("C:\\Server Files", provider.GetGameFileDirectory());
        }
        public void GetSteamCmdDirectory()
        {
            GhostPanelConfig config = FakeConfig.GetFakeConfig();
            var provider            = new DefaultDirectoryProvider(config);

            Assert.Equal("C:\\SteamCmd", provider.GetSteamCmdDirectory());
        }
        public void GetCorrectCredentailStringForUserAndPass()
        {
            GhostPanelConfig config = FakeConfig.GetFakeConfig();

            config.SteamSettings.Password = "******";
            config.SteamSettings.Username = "******";
            var credProvider = new SteamCredentialProvider(config);

            Assert.Equal("TestUser Password123", credProvider.GetCredentialString());
        }
        protected WorkflowCleanerTests(IDbProvider <WorkflowDbContext> workflowDbProvider)
        {
            _WorkflowDbProvider = workflowDbProvider ?? throw new ArgumentNullException(nameof(workflowDbProvider));
            _DbContext          = _WorkflowDbProvider.CreateNew();
            _FakeConfig         = new FakeConfig();
            _Dtp = new FakeDtp();

            var lf = new LoggerFactory();
            var expWorkflowLogger = new ExpiredWorkflowLoggingExtensions(lf.CreateLogger <ExpiredWorkflowLoggingExtensions>());

            _Command = new RemoveExpiredWorkflowsCommand(_WorkflowDbProvider.CreateNew, expWorkflowLogger, _Dtp, _FakeConfig);
        }
Esempio n. 7
0
            public void Setup()
            {
                _processMonitor = MockRepository.GenerateDynamicMockWithRemoting<IMonitorProcesses>();
                ProcessMonitor.Instance = _processMonitor;

                _oldOut = Console.Out;

                _consoleOutput = new StringBuilder();
                Console.SetOut(new StringWriter(_consoleOutput));

                _fakeHost = new FakeHost();
                _fakeConfig = new FakeConfig(_fakeHost);
            }
    public void Test()
    {
        var config = new FakeConfig(new Dictionary <string, string> {
            ["int"] = "3", ["double"] = "abc", ["array"] = "1,2,3",
        });

        Assert.Equal(3, config.GetProperty("int", new int?()));
        Assert.Equal(3d, config.GetProperty("double", 3d));

        var array = config.GetProperty("array", ",", Array.Empty <string>());

        Assert.NotNull(array);
        Assert.Equal(new[] { "1", "2", "3" }, array);
    }
Esempio n. 9
0
        public WorkflowCleanerTests()
        {
            WorkflowDbContext Func() => new WorkflowDbContext(new DbContextOptionsBuilder().UseSqlServer("Data Source=.;Initial Catalog=WorkflowCleanerTests;Integrated Security=True").Options);

            _DbContext = Func();
            var db = _DbContext.Database;

            db.EnsureDeleted();
            db.EnsureCreated();

            _FakeConfig = new FakeConfig();
            _Dtp        = new FakeDtp();
            var lf = new LoggerFactory();

            _Command = new RemoveExpiredWorkflowsCommand(Func, lf.CreateLogger <RemoveExpiredWorkflowsCommand>(), _Dtp, _FakeConfig);
        }
        public void Options_customization_can_access_configuration_if_set()
        {
            // Arrange
            var config  = new FakeConfig();
            var factory = new SelfContainedWebApplicationFactoryWithWebHost <When_using_assembly_scanner>
                          (
                configureServices: services =>
            {
                services.AddViewModelComposition(options =>
                {
                    options.TypesFilter = type =>
                    {
                        if (type.Assembly.FullName.Contains("TestClassLibraryWithHandlers"))
                        {
                            return(true);
                        }

                        if (type == typeof(EmptyCustomizations))
                        {
                            return(false);
                        }

                        if (type.IsNestedTypeOf <When_using_assembly_scanner>())
                        {
                            return(true);
                        }

                        return(false);
                    };
                }, config);
                services.AddRouting();
            },
                configure: app =>
            {
                app.UseRouting();
                app.UseEndpoints(builder => builder.MapCompositionHandlers());
            }
                          );

            // Act
            var client = factory.CreateClient();

            // Assert
            Assert.Same(config, _customizationsThatAccessTheConfigurationConfig);
        }
Esempio n. 11
0
        public void CanBindConfiguratonSection()
        {
            var registry = new FakeConfigurationRegistry();

            registry.SetKeyAsync("FakeConfig:Setting1", "abc");
            registry.SetKeyAsync("FakeConfig:Setting2", "def");

            var builder = new ConfigurationBuilder()
                          .AddConfigurationRegistry(registry)
                          .Build();

            var config = new FakeConfig();

            builder.GetSection("FakeConfig").Bind(config);

            Assert.Equal("abc", config.Setting1);
            Assert.Equal("def", config.Setting2);
        }
Esempio n. 12
0
        public void HookConfigurationBase_ctor()
        {
            var fc = new FakeConfig();

            Assert.IsNotNull(fc);

            fc.BeforeStepScreenShotEnabled     = !fc.AfterScenarioScreenShotEnabled;
            fc.AfterStepScreenShotEnabled      = !fc.AfterStepScreenShotEnabled;
            fc.BeforeScenarioScreenShotEnabled = !fc.BeforeScenarioScreenShotEnabled;
            fc.AfterScenarioScreenShotEnabled  = !fc.AfterScenarioScreenShotEnabled;

            fc.WindowsPosition = new System.Drawing.Point(100, 100);
            fc.WindowsSize     = new System.Drawing.Size(500, 500);
            fc.WindowsState    = WindowsState.FullScreen;
            var ts = TimeSpan.FromSeconds(2);

            fc.ImplicitWaitTimeout           = ts;
            fc.AsynchronousJavaScriptTimeout = ts;
            fc.PageLoadTimeout = ts;
        }
Esempio n. 13
0
            public void WithDependencies()
            {
                Host host = new Host(_initializationStrategyFactory);
                var config = new FakeConfig(host);
                var dependency1 = new FakeDependency("Some Service");
                var dependency2 = new FakeDependency("Some Other Service");

                config.Dependencies = new List<Dependency>
                                          {
                                              dependency1,
                                              dependency2,
                                          };

                CreatesInitializationStrategy();
                InitializesTheHost(config);

                host.Run(config);

                Assert.IsTrue(dependency1.Started);
                Assert.IsTrue(dependency2.Started);
            }
Esempio n. 14
0
            public void WithRegistrations()
            {
                Host host = new Host(_initializationStrategyFactory);
                var config = new FakeConfig(host);
                config.WithRegistrations(b => b.Register(c => new Thing()));

                ContainerProvider.Instance.ApplicationContainer = config.Compile();

                CreatesInitializationStrategy();
                InitializesTheHost(config);

                host.Run(config);

                Assert.IsTrue(ContainerProvider.Instance.ApplicationContainer.IsRegistered(typeof(Thing)));
            }
Esempio n. 15
0
            public void WithNoDependencies()
            {
                Host host = new Host(_initializationStrategyFactory);
                var config = new FakeConfig(host);

                CreatesInitializationStrategy();
                InitializesTheHost(config);

                host.Run(config);
            }
Esempio n. 16
0
            public void WithMultiTenantContainerBuilderAction()
            {
                Host host = new Host(_initializationStrategyFactory);
                var config = new FakeConfig(host);
                config.WithRegistrations(b => b.Register(c => new Thing()))
                    .WithMultiTenantContainer((c) => new MultitenantContainer(new DummyTenantIdentificationStrategy(), c));

                ContainerProvider.Instance.ApplicationContainer = config.Compile();

                CreatesInitializationStrategy();
                InitializesTheHost(config);

                host.Run(config);

                Assert.IsTrue(ContainerProvider.Instance.ApplicationContainer.IsRegistered(typeof(Thing)));
                Assert.IsTrue(ContainerProvider.Instance.ApplicationContainer is MultitenantContainer);
            }
Esempio n. 17
0
            public void WithInstallModeSet()
            {
                Host host = new Host(_initializationStrategyFactory);
                var config = new FakeConfig(host);
                config.InstallMode = InstallMode.Uninstall;

                CreatesInitializationStrategy();
                InitializesTheHost(config);

                host.Run(config);
            }