public void AddSuggestion(Suggestion suggestion, string filePath)
        {
            var repo = new SuggestionRepository();
            repo.AddSuggestion(suggestion, filePath);
           

        }
        public Response<List<Suggestion>> DisplaySuggestions(string filePath)
        {
            var repo = new SuggestionRepository();
            var response = new Response<List<Suggestion>>();
            var suggestions = repo.GetAllSuggestions(filePath);
            try
            {
                if (suggestions.Count > 0)
                {
                    response.Success = true;
                    response.Data = suggestions;

                }
                else
                {
                    response.Success = false;
                    response.Message = "No Files were found";
                }
            }
            catch (Exception ex)
            {
                response.Success = false;
                response.Message = ex.Message;
            }
            return response;
        }
Beispiel #3
0
        public void AddSuggestion(Suggestion suggestion)
        {
            var repo = new SuggestionRepository();
            repo.AddSuggestion(suggestion);
           

        }
 public void GetSuggestionsTest()
 {
     var repo = new SuggestionRepository();
     var suggestions = repo.GetAllSuggestions();
     var suggestion = suggestions.First();
     Assert.AreEqual("Bob", suggestion.EmployeeName);
 }
        public void GetSuggestionsTest()
        {
            var repo = new SuggestionRepository();
            string filePath = @"C:\Users\Apprentice\Desktop\GitHub\KileyDowling\SGCorpHRV2\SGCorpHR\SGCorpHR.TEST\Suggestions\Suggestions.txt";
            var suggestions = repo.GetAllSuggestions(filePath);
            var suggestion = suggestions.First();
            Assert.AreEqual("Bob", suggestion.EmployeeName);

        }
        public void RemoveSuggestionTest()
        {
            var repo = new SuggestionRepository();

            repo.RemoveFile(1);

            var suggestions = repo.GetAllSuggestions();
            Assert.IsFalse(suggestions.Exists(s => s.SuggestionID == 1));
        }
        public void RemoveSuggestionTest()
        {
            var repo = new SuggestionRepository();
            int suggestionID = 3;
            string filePath = @"C:\Users\Apprentice\Desktop\GitHub\KileyDowling\SGCorpHRV2\SGCorpHR\SGCorpHR.TEST\Suggestions\Suggestions.txt";
            repo.RemoveFile(suggestionID, filePath);

            var suggestions = repo.GetAllSuggestions(filePath);
            Assert.IsFalse(suggestions.Exists(s => s.SuggestionID == 3));

        }
        public void SubmitSuggestionTest()
        {
            var repo = new SuggestionRepository();

            var suggestion = new Suggestion()
            {
                SuggestionText = "Test",
                EmployeeName = "Johnny"
            };

            repo.AddSuggestion(suggestion);
            Assert.AreEqual("Johnny", suggestion.EmployeeName);
        }
        public void DeleteSuggestions(int suggestionID, string filePath)
        {
            var repo = new SuggestionRepository();
            var response = new Response<List<Suggestion>>();
            repo.RemoveFile(suggestionID, filePath);
            try
            {
                response.Success = true;

            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
            }
        }
        public void SubmitSuggestionTest()
        {
            var repo = new SuggestionRepository();

            var suggestion = new Suggestion()
            {
                SuggestionText = "Test",
                EmployeeName = "Johnny"
            };

            string filePath =
                @"C:\Users\Apprentice\Desktop\GitHub\KileyDowling\SGCorpHRV2\SGCorpHR\SGCorpHR.TEST\Suggestions\Suggestions.txt";

            repo.AddSuggestion(suggestion, filePath);
            Assert.AreEqual("Johnny", suggestion.EmployeeName);

        }