public void Handle_ShouldReturnSkillResponse_WhenTokenUserPlayersHasPlayersWithOnePoint() { Mock <ILogger <AddAllPoints> > mockLogger = new Mock <ILogger <AddAllPoints> >(); Mock <ISkillRequestValidator> mockSkillRequestValidator = new Mock <ISkillRequestValidator>(); mockSkillRequestValidator.Setup(x => x.IsValid(It.IsAny <SkillRequest>())).Returns(true); AddAllPoints sut = new AddAllPoints(mockLogger.Object, mockSkillRequestValidator.Object); SkillRequest skillRequest = GenerateValidSkillRequest(new IntentRequest() { RequestId = "TestRequestId", Locale = "en-US", Type = "IntentRequest", Intent = new Intent() { ConfirmationStatus = "CONFIRMED", Name = "AddPoints", Slots = new Dictionary <string, Slot>() { { "amount", new Slot() { Name = "amount", Value = "1", ConfirmationStatus = "NONE" } }, { "player", new Slot() { Name = "player", Value = "blue", ConfirmationStatus = "NONE" } } } } }); TokenUser tokenUser = new TokenUser(); tokenUser.Players = new List <Player>() { new Player() { Name = "Blue", Points = 3 } }; SkillResponse skillResponse = sut.Handle(skillRequest, tokenUser); Assert.IsType <SkillResponse>(skillResponse); }
public void Handle_ShouldThrowArgumentNullException_WhenTokenUserIsNull() { Mock <ILogger <AddAllPoints> > mockLogger = new Mock <ILogger <AddAllPoints> >(); Mock <ISkillRequestValidator> mockSkillRequestValidator = new Mock <ISkillRequestValidator>(); mockSkillRequestValidator.Setup(x => x.IsValid(It.IsAny <SkillRequest>())).Returns(true); AddAllPoints sut = new AddAllPoints(mockLogger.Object, mockSkillRequestValidator.Object); SkillRequest skillRequest = GenerateValidSkillRequest(new IntentRequest() { RequestId = "TestRequestId", Locale = "en-US", Type = "IntentRequest", Intent = new Intent() { ConfirmationStatus = "CONFIRMED", Name = "AddPoints", Slots = new Dictionary <string, Slot>() { { "amount", new Slot() { Name = "amount", Value = "1", ConfirmationStatus = "NONE" } }, { "player", new Slot() { Name = "player", Value = "blue", ConfirmationStatus = "NONE" } } } } }); Assert.Throws <ArgumentNullException>(() => sut.Handle(skillRequest, null)); }