Пример #1
0
        public void ChangeFeedbackInvalidParameters_Should()
        {
            string bugName = "BugNameShould";

            List <string> parameters = new List <string>
            {
                bugName
            };

            ChangeFeedbackRatingCommand command = new ChangeFeedbackRatingCommand(parameters);

            command.Execute();
        }
        public void ThrowExeptionWhenCommandParametersAreLessThanItShould()
        {
            string feedbackTitle = "FeedbackTitle";
            string description   = "MegaBadFeedback";
            int    rating        = 4;
            var    feedback      = new Feedback(feedbackTitle, description, rating);

            database.Feedbacks.Add(feedback);

            List <string> parameters = new List <string>
            {
                feedbackTitle
            };

            ChangeFeedbackRatingCommand command = new ChangeFeedbackRatingCommand(parameters);

            command.Execute();
        }
        public void BiggerRating_Should()
        {
            string    feedbackTitle = "feedbackTitle";
            string    description   = "Feedback description";
            int       rating        = 6;
            IFeedback feedback      = new Feedback(feedbackTitle, description, rating);


            database.Feedbacks.Add(feedback);

            string newRating = "6";

            List <string> parameters = new List <string>
            {
                feedbackTitle,
                newRating
            };

            ChangeFeedbackRatingCommand command = new ChangeFeedbackRatingCommand(parameters);

            command.Execute();
        }
        public void ThrowsExceptionWhenDescIsNULL_Should()
        {
            string    feedbackTitle = "feedbackTitle";
            string    description   = null;
            int       rating        = 4;
            IFeedback feedback      = new Feedback(feedbackTitle, description, rating);


            database.Feedbacks.Add(feedback);

            string newRating = "3";

            List <string> parameters = new List <string>
            {
                feedbackTitle,
                newRating
            };

            ChangeFeedbackRatingCommand command = new ChangeFeedbackRatingCommand(parameters);

            command.Execute();
        }
        public void InputFeedbackNameIsNULL_Should()
        {
            string    feedbackTitle = null;
            string    description   = "Feedback description";
            int       rating        = 4;
            IFeedback feedback      = new Feedback(feedbackTitle, description, rating);


            database.Feedbacks.Add(feedback);

            string newRating = "3";

            List <string> parameters = new List <string>
            {
                feedbackTitle,
                newRating
            };

            ChangeFeedbackRatingCommand command = new ChangeFeedbackRatingCommand(parameters);

            command.Execute();
        }
        public void ThrowExeptionWhenCommandParametersAreMoreThanItShould()
        {
            string feedbackTitle = "FeedbackShould";
            string description   = "MegaBadFeedback";
            int    rating        = 4;
            var    feedback      = new Feedback(feedbackTitle, description, rating);

            database.Feedbacks.Add(feedback);

            FeedbackStatus feedbackStatus = FeedbackStatus.Scheduled;

            List <string> parameters = new List <string>
            {
                feedbackTitle,
                feedbackStatus.ToString(),
                feedbackTitle
            };

            ChangeFeedbackRatingCommand command = new ChangeFeedbackRatingCommand(parameters);

            command.Execute();
        }
        public void ValidChangeFeedbackRating_Should()
        {
            string    feedbackTitle = "feedbackTitle";
            string    description   = "Feedback description";
            int       rating        = 4;
            IFeedback feedback      = new Feedback(feedbackTitle, description, rating);


            database.Feedbacks.Add(feedback);

            string newRating = "3";

            List <string> parameters = new List <string>
            {
                feedbackTitle,
                newRating
            };

            ChangeFeedbackRatingCommand command = new ChangeFeedbackRatingCommand(parameters);

            command.Execute();
            Assert.IsTrue(feedback.Rating.Equals(int.Parse(newRating)));
        }