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