public void RegisterPoints(Question question, int value) { if (question.Points == 0 && question.Status == 1) { AddPoints?.Invoke(this, new AddPointsEventArgs(question.QuestionID, value)); } }
protected virtual void Start() { _addPoints = new AddPoints(); EventManager.AddPointsInvoker(this); _blockEvent = new BlockEvent(); EventManager.BlockInvoker(this); }
public static void AddPointsInvoker(AddPoints inputEvent) { addPointsInvokers.Add(inputEvent); foreach (var currentAction in addPointsListeners) { inputEvent.AddListener(currentAction); } }
public void Ctor_ShouldReturnInstanceOfClass_WhenDependenciesAreValid() { Mock <ILogger <AddPoints> > mockLogger = new Mock <ILogger <AddPoints> >(); Mock <ISkillRequestValidator> mockSkillRequestValidator = new Mock <ISkillRequestValidator>(); AddPoints sut = new AddPoints(mockLogger.Object, mockSkillRequestValidator.Object); Assert.IsType <AddPoints>(sut); }
private void AddNumber_KeyPress(object sender, KeyPressEventArgs e)//нажатие клавиши { if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar)) { e.Handled = true; } if (e.KeyChar.Equals((char)13)) { AddPoints.Focus(); } }
public void Handle_ShouldReturnSkillResponse_WhenCalled() { Mock <ILogger <AddPoints> > mockLogger = new Mock <ILogger <AddPoints> >(); Mock <ISkillRequestValidator> mockSkillRequestValidator = new Mock <ISkillRequestValidator>(); mockSkillRequestValidator.Setup(x => x.IsValid(It.IsAny <SkillRequest>())).Returns(true); AddPoints sut = new AddPoints(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>() { { "player", new Slot() { Name = "player", Value = "blue", ConfirmationStatus = "NONE" } }, { "amount", new Slot() { Name = "amount", Value = "3", ConfirmationStatus = "NONE" } } } } }); TokenUser tokenUser = new TokenUser() { Players = new List <Player>() }; SkillResponse skillResponse = sut.Handle(skillRequest, tokenUser); Assert.IsType <AddPoints>(sut); }
public void Handle_ShouldThrowArgumentNullException_WhenTokenUserIsNull() { Mock <ILogger <AddPoints> > mockLogger = new Mock <ILogger <AddPoints> >(); Mock <ISkillRequestValidator> mockSkillRequestValidator = new Mock <ISkillRequestValidator>(); mockSkillRequestValidator.Setup(x => x.IsValid(It.IsAny <SkillRequest>())).Returns(true); AddPoints sut = new AddPoints(mockLogger.Object, mockSkillRequestValidator.Object); SkillRequest skillRequest = new SkillRequest(); Assert.Throws <ArgumentNullException>(() => sut.Handle(skillRequest, null)); }
public void Handle_ShouldThrowArgumentNullException_WhenCalledWithInvalidSkillRequest() { Mock <ILogger <AddPoints> > mockLogger = new Mock <ILogger <AddPoints> >(); Mock <ISkillRequestValidator> mockSkillRequestValidator = new Mock <ISkillRequestValidator>(); mockSkillRequestValidator.Setup(x => x.IsValid(It.IsAny <SkillRequest>())).Returns(false); AddPoints sut = new AddPoints(mockLogger.Object, mockSkillRequestValidator.Object); TokenUser tokenUser = new TokenUser() { Players = new List <Player>() }; SkillRequest skillRequest = new SkillRequest(); Assert.Throws <ArgumentNullException>(() => sut.Handle(skillRequest, tokenUser)); }
private void OnTriggerEnter2D(Collider2D collision) { Restart.Invoke(); AddPoints.Invoke(); audioSource.Play(); }
private void OnAddPoints(AddPoints e) { _points += e.Points; _text.text = $"Workplace Efficiency Rating: { _points}"; }
virtual protected void Start() { addPoints = new AddPoints(); EventManager.AddAddPointsInvoker(this); }
private void addPointsToolStripMenuItem_Click(object sender, EventArgs e) { AddPoints ap = new AddPoints(); ap.Show(); }
// Start is called before the first frame update protected virtual void Start() { addPointsEvent = new AddPoints(); EventManager.AddPointsEventInvoker(this); }
public Coins(Texture2D texture, Vector2 pos, AddPoints addPoints) : base(texture, pos) { this.addPoints = addPoints; }