示例#1
0
        public void CreateFeedbackTest()
        {
            _databaseContext.Feedback.RemoveRange(_databaseContext.Feedback.ToList());
            var goodFeedback = new StudyBuddyBackend.Database.Entities.Feedback
            {
                AuthorUsername   = "******",
                RevieweeUsername = "******",
                Comment          = "test",
                Rating           = 5
            };

            _feedbackController.AddFeedback(goodFeedback);

            Assert.StrictEqual(goodFeedback, _databaseContext.Feedback.Find("titas", "emilis"));
        }
示例#2
0
        public async void AddFeedback_ValidInput_Success()
        {
            _mockDataStore.Setup(x => x.AddFeedback(It.IsAny <IFeedback>()))
            .ReturnsAsync(new FeedbackEntry
            {
                Feedback = new Feedback()
                {
                    FeedbackID = 1
                }
            });

            var result = await _sut.AddFeedback(new FeedbackViewModel()
            {
                FeedbackScore = 5, GameSessionID = 1, PlayerID = 1
            });

            var createdAtRouteResult = result as CreatedAtRouteResult;

            Assert.NotNull(createdAtRouteResult);
            Assert.IsAssignableFrom <FeedbackEntry>(createdAtRouteResult.Value);
            Assert.Equal(1, ((FeedbackEntry)createdAtRouteResult.Value).Feedback.FeedbackID);
        }