예제 #1
0
        public void Draw(Configuration configuration)
        {
            SchemaEntity schema;

            using (var fileStream = FileManager.OpenFileStream(configuration.SchemaFilePath))
            {
                schema = _schemaReader.Read(fileStream);
            }

            var points = _pointPositionCalculator.Handle(schema);

            if (FileManager.IsExist(configuration.DirectoryPath))
            {
                throw new Exception("Такая папка уже существует");
            }
            FileManager.CreateDirectory(configuration.DirectoryPath);
            FileManager.CopyFile("readme.md", Path.Combine(configuration.DirectoryPath, "readme.md"));
            using (var repo = new Repository(Repository.Init(configuration.DirectoryPath)))
            {
                Commands.Stage(repo, "readme.md");
                var maxCommitsCount = configuration.MaxCommitsCount > 4 ? configuration.MaxCommitsCount : 4;
                _commitCreator.Create(points, repo, maxCommitsCount, configuration.FileName, configuration.UserName,
                                      configuration.UserEmail);
            }
        }
예제 #2
0
        public void ReturnCorrectData()
        {
            var schema = CreateEmptySchema();

            schema.Points[0, 0] = PointType.darkest;
            schema.Points[3, 4] = PointType.dusky;

            var points = PointPositionsCalculator.Handle(schema);

            points.Should().BeEquivalentTo(new List <PointPosition>
            {
                new PointPosition(0, 0, Saturation.Deep, new DateTime(2017, 9, 24)),
                new PointPosition(4, 3, Saturation.MidDeep, new DateTime(2017, 10, 25))
            });
        }