예제 #1
0
        public void ServerConfig_LoadConfig_Success()
        {
            // Arrange
            var settingsMock        = new Mock <ISettings>();
            var serverConfigDirPath = Path.Join(_workingDirectory, _serverConfigDirName);

            settingsMock.Setup(settings => settings.ServerExecutable).Returns(Directory.GetCurrentDirectory());
            settingsMock.Setup(settings => settings.ServerConfigDirectory)
            .Returns(serverConfigDirPath);
            var expectedServerConfigFiles = new[] { "server.cfg", "basic.cfg", "common.json", "common.Arma3Profile" };

            // Act
            IConfig serverConfig = new ServerConfig(settingsMock.Object, NullLogger <ServerConfig> .Instance, _fileSystemMock);
            var     configLoaded = serverConfig.CopyConfigFiles();

            // Assert
            using (new AssertionScope())
            {
                configLoaded.IsSuccess.Should().BeTrue();
                _fileSystemMock.Directory.Exists(serverConfigDirPath).Should().BeTrue();
                _fileSystemMock.Directory.GetFiles(serverConfigDirPath)
                .Select(Path.GetFileName).Should().BeEquivalentTo(expectedServerConfigFiles);
            }
        }