public void it_should_find_the_file() { var sut = new CsvFileRepository().Reset(); sut.Save(new CsvFile()); sut.Save(new CsvFile()); var file = sut.FindBy(2); Assert.NotNull(file); Assert.AreEqual(file.Id, 2); }
public void it_should_have_saved_the_file() { var sut = new CsvFileRepository().Reset(); sut.Save(new CsvFile()); Assert.AreEqual(sut.AllFiles().Count(), 1); }
public void WriteCsvResults(CsvFileRepository repo, List <RunResult> runs) { var players = runs.Select((x, idx) => new Player() { Name = x.PlayerName, Score = GetScore(x), Rank = idx }) .OrderByDescending(x => x.Score) .ThenBy(x => x.Name) .ToList(); var scoreBoard = new ScoreBoard() { BatchDateTime = DateTime.Now, Players = players }; repo.Save(scoreBoard); }
public void Save_Should_Write_OntoFile() { var scoreBoard = new ScoreBoard(); scoreBoard.Players = new System.Collections.Generic.List <Player>() { new Player() { Name = "Test", Score = 2000 } }; repo.Save(scoreBoard); var files = Directory.GetFiles(TestFile, "*.csv"); Assert.IsTrue(files.Any()); }