예제 #1
0
        public void GetReminders_Should_return_added_reverted_added_again_file()
        {
            var commitModel = new[]
            {
                new CallbackModel.CommitModel
                {
                    Added = new[]
                    {
                        ".reminders/jsonInReminders.json",
                    }
                },
                new CallbackModel.CommitModel
                {
                    Removed = new[]
                    {
                        ".reminders/jsonInReminders.json",
                    }
                },
                new CallbackModel.CommitModel
                {
                    Added = new[]
                    {
                        ".reminders/jsonInReminders.json",
                    }
                },
            };

            var result = CommitParser.GetReminders(commitModel);

            var file = Assert.Single(result);

            Assert.Equal(".reminders/jsonInReminders.json", file);
        }
예제 #2
0
        public void GetReminders_should_include_modified_reminders()
        {
            var commitModel = new[]
            {
                new CallbackModel.CommitModel
                {
                    Added = new[]
                    {
                        ".reminders/newReminder.json",
                    },
                    Modified = new[]
                    {
                        ".reminders/existingReminder1.json"
                    }
                },
                new CallbackModel.CommitModel
                {
                    Removed = new[]
                    {
                        ".reminders/existingReminder1.json",
                    }
                },
                new CallbackModel.CommitModel
                {
                    Modified = new []
                    {
                        ".reminders/newReminder.json",
                        ".reminders/existingReminder2.json"
                    }
                },
            };

            var result = CommitParser.GetReminders(commitModel);

            Assert.Equal(new[]
            {
                ".reminders/newReminder.json",
                ".reminders/existingReminder2.json"
            }, result);
        }
예제 #3
0
        public void GetReminders_Should_not_return_deleted_modified_files()
        {
            var commitModel = new[]
            {
                new CallbackModel.CommitModel
                {
                    Modified = new[]
                    {
                        ".reminders/jsonInReminders.json",
                    }
                },
                new CallbackModel.CommitModel
                {
                    Removed = new[]
                    {
                        ".reminders/jsonInReminders.json",
                    }
                }
            };

            var result = CommitParser.GetReminders(commitModel);

            Assert.Empty(result);
        }
예제 #4
0
        public void GetReminders_Should_return_added_files_from_all_commits()
        {
            var commitModel = new[]
            {
                new CallbackModel.CommitModel()
                {
                    Added = new[]
                    {
                        ".reminders/jsonInReminders1.json",
                    }
                },
                new CallbackModel.CommitModel()
                {
                    Added = new[]
                    {
                        ".reminders/jsonInReminders2.json",
                    }
                },
                new CallbackModel.CommitModel()
                {
                    Added = new[]
                    {
                        ".reminders/jsonInReminders3.json",
                    }
                },
            };

            var result = CommitParser.GetReminders(commitModel);

            Assert.Equal(new[]
            {
                ".reminders/jsonInReminders1.json",
                ".reminders/jsonInReminders2.json",
                ".reminders/jsonInReminders3.json"
            }, result);
        }
예제 #5
0
        public void GetReminders_Should_only_return_files_in_reminder_folder()
        {
            var commitModel = new[]
            {
                new CallbackModel.CommitModel()
                {
                    Added = new[]
                    {
                        "jsonInRootFolder.json",
                        ".reminders/markdownInReminders.md",
                        ".reminders/fileWithoutFiletype",
                        ".reminders/jsonInReminders.json",
                        "subfolder/jsonInSubfolder.json"
                    }
                }
            };

            var result = CommitParser.GetReminders(commitModel);

            Assert.Equal(3, result.Length);
            Assert.Contains(".reminders/jsonInReminders.json", result);
            Assert.Contains(".reminders/fileWithoutFiletype", result);
            Assert.Contains(".reminders/markdownInReminders.md", result);
        }
예제 #6
0
 public void Should_return_no_results_when_no_commits()
 {
     Assert.Empty(CommitParser.GetReminders(new CallbackModel.CommitModel[0]));
     Assert.Empty(CommitParser.GetDeletedReminders(new CallbackModel.CommitModel[0]));
 }