Esempio n. 1
0
        public async void RespondToSuggestion_SessionRepository_AddIntroduction_IsCalledOnce()
        {
            string userId = "Test-ID";

            ResponseToSuggestion request = new ResponseToSuggestion()
            {
                RequestMatch    = true,
                SuggestedUserId = "Test-Suggested-Id"
            };

            sessionService.Setup(x => x.GetCurrentUserId()).Returns(userId);
            suggesionsRepository.Setup(x => x.AddIntroduction(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <bool>())).ReturnsAsync(true);

            ObjectResult result = await subject.RespondToSuggestion(request);

            suggesionsRepository.Verify(x => x.AddIntroduction(userId, request.SuggestedUserId, request.RequestMatch), Times.Once);
        }
Esempio n. 2
0
        public async void RespondToSuggestion_AlwaysReturnsA200()
        {
            string userId = "Test-ID";

            ResponseToSuggestion request = new ResponseToSuggestion()
            {
                RequestMatch    = true,
                SuggestedUserId = "Test-Suggested-Id"
            };

            sessionService.Setup(x => x.GetCurrentUserId()).Returns(userId);
            suggesionsRepository.Setup(x => x.AddIntroduction(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <bool>())).ReturnsAsync(true);

            ObjectResult result = await subject.RespondToSuggestion(request);

            Assert.Equal(200, result.StatusCode);
        }