예제 #1
0
        public void DeleteBacklogTest()
        {
            var testGuid = Guid.NewGuid();
            var repo     = new BacklogRepo(TestRootDir, () => testGuid);

            var testBacklog = new Backlog()
            {
                Id          = String.Empty,
                Title       = "TestBacklog",
                UserStories = new [] { "A", "B", "C", "D" }
            };

            repo.SaveBacklog(testBacklog, TestId);
            repo.WriteSubmission(TestId, new Submission()
            {
                Indexes = new [] { 3, 2, 1, 0 }
            });

            var backlogFolderPath = Path.Combine(Environment.CurrentDirectory, _testDir);

            Directory.Exists(backlogFolderPath).Should().BeTrue();
            Directory.GetFiles(backlogFolderPath).Length.Should().Be(2, "exactly two files have been added to directory");

            repo.DeleteBacklog(TestId);
            Directory.Exists(backlogFolderPath).Should().BeFalse();

            Action act = () => repo.DeleteBacklog("Rubbish");

            act.Should().Throw <DirectoryNotFoundException>("directory \"Rubbish\" does not exist");
        }
예제 #2
0
        public void DeleteBacklogTest()
        {
            var testGuid = Guid.NewGuid();
            var repo     = new BacklogRepo(TestRootDir, () => testGuid);

            var testBacklog = new Backlog()
            {
                Id          = String.Empty,
                Title       = "TestBacklog",
                UserStories = new[] { "A", "B", "C", "D" }
            };

            repo.SaveBacklog(testBacklog, TestId);
            repo.WriteSubmission(TestId, new Submission()
            {
                Indexes = new[] { 3, 2, 1, 0 }
            });

            var backlogFolderPath = Path.Combine(Environment.CurrentDirectory, _testDir);

            Directory.Exists(backlogFolderPath).Should().BeTrue();
            Directory.GetFiles(backlogFolderPath).Length.Should().Be(2, "exactly two files have been added to directory");

            var status = repo.DeleteBacklog(TestId);

            status.Should().BeOfType <Success>();
            Directory.Exists(backlogFolderPath).Should().BeFalse();

            status = repo.DeleteBacklog("Rubbish");
            status.Should().BeOfType <Failure>().Which.ErrorMessage.Should().Contain("Could not find a part of the path");
        }