Пример #1
0
 public Result <EntityGroups> GetEntityGroups()
 {
     if (_entityGroups == null)
     {
         var config = new EntityGroupsFile(_gamePaths);
         _entityGroups = _gameDataRepository.GetConfigData(config);
         _entityGroups = _linkerFactory.GetLinker(_entityGroups).Link(_entities);
     }
     return(Result.Ok(_entityGroups));
 }
Пример #2
0
        public void GetMapper_EntityGroups_Returns_EntityGroupsMapper()
        {
            //Arrange
            var mapperFactory = new MapperFactory(_entitiesMapper.Object, _entityGroupsMapper.Object);
            var config        = new EntityGroupsFile(_gamePaths.Object);

            //Act
            var mapper = mapperFactory.GetMapper(config);

            //Assert
            Assert.IsInstanceOfType(mapper, typeof(IMapper <entitygroups, EntityGroups>));
        }
Пример #3
0
        public void GetConfigData_EntityGroups()
        {
            //Arrange
            var testPaths          = new TestPaths();
            var configFile         = new EntityGroupsFile(testPaths);
            var gameDataRepository = GetGameDataRepository();

            //Act
            var entityGroups = gameDataRepository.GetConfigData(configFile);

            //Assert
            Assert.IsNotNull(entityGroups);
            Assert.IsTrue(entityGroups.Count > 0);
        }
Пример #4
0
        public Result Save <T>(T data, string fullPath = null)
        {
            switch (data)
            {
            case Entities d:
                var entitiesConfig = new EntityClassesFile(_gamePaths);
                _gameDataRepository.SaveConfigData(entitiesConfig, d, fullPath);
                break;

            case EntityGroups d:
                var entityGroupsConfig = new EntityGroupsFile(_gamePaths);
                _gameDataRepository.SaveConfigData(entityGroupsConfig, d, fullPath);
                break;
            }

            return(Result.Ok());
        }