private static void CreateNewVote(string user, VoteTypes act) { if (TwitchGame.BombActive && act == VoteTypes.Detonation) { if (TwitchGame.Instance.VoteDetonateAttempted) { IRCConnection.SendMessage($"Sorry, {user}, a detonation vote was already attempted on this bomb. Another one cannot be started."); return; } TwitchGame.Instance.VoteDetonateAttempted = true; } CurrentVoteType = act; VoteTimeRemaining = TwitchPlaySettings.data.VoteCountdownTime; Voters.Clear(); Voters.Add(user, true); IRCConnection.SendMessage($"Voting has started by {user} to \"{PossibleVotes[CurrentVoteType].name}\"! Vote with '!vote VoteYea ' or '!vote VoteNay '."); voteInProgress = TwitchPlaysService.Instance.StartCoroutine(VotingCoroutine()); if (TwitchGame.Instance.alertSound != null) { TwitchGame.Instance.alertSound.Play(); } if (TwitchGame.BombActive) { TwitchGame.ModuleCameras.SetNotes(); } }
public virtual BOVoteTypes MapEFToBO( VoteTypes ef) { var bo = new BOVoteTypes(); bo.SetProperties( ef.Id, ef.Name); return(bo); }
public virtual VoteTypes MapBOToEF( BOVoteTypes bo) { VoteTypes efVoteTypes = new VoteTypes(); efVoteTypes.SetProperties( bo.Id, bo.Name); return(efVoteTypes); }
public void MapEFToBO() { var mapper = new DALVoteTypesMapper(); VoteTypes entity = new VoteTypes(); entity.SetProperties(1, "A"); BOVoteTypes response = mapper.MapEFToBO(entity); response.Id.Should().Be(1); response.Name.Should().Be("A"); }
public void MapBOToEF() { var mapper = new DALVoteTypesMapper(); var bo = new BOVoteTypes(); bo.SetProperties(1, "A"); VoteTypes response = mapper.MapBOToEF(bo); response.Id.Should().Be(1); response.Name.Should().Be("A"); }
public void MapEFToBOList() { var mapper = new DALVoteTypesMapper(); VoteTypes entity = new VoteTypes(); entity.SetProperties(1, "A"); List <BOVoteTypes> response = mapper.MapEFToBO(new List <VoteTypes>() { entity }); response.Count.Should().Be(1); }
public static void StartVote(string user, VoteTypes act) { if (!TwitchPlaySettings.data.EnableVoting) { IRCConnection.SendMessage($"Sorry, {user}, voting is disabled."); return; } if (Active) { IRCConnection.SendMessage($"Sorry, {user}, there's already a vote in progress."); return; } CreateNewVote(user, act); }
public async void Get() { var mock = new ServiceMockFacade <IVoteTypesRepository>(); var record = new VoteTypes(); mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(record)); var service = new VoteTypesService(mock.LoggerMock.Object, mock.RepositoryMock.Object, mock.ModelValidatorMockFactory.VoteTypesModelValidatorMock.Object, mock.BOLMapperMockFactory.BOLVoteTypesMapperMock, mock.DALMapperMockFactory.DALVoteTypesMapperMock); ApiVoteTypesResponseModel response = await service.Get(default(int)); response.Should().NotBeNull(); mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>())); }
public static void StartVote(TwitchBomb TPBomb, string user, VoteTypes act) { if (!TwitchPlaySettings.data.EnableVoting) { IRCConnection.SendMessage("Voting is disabled"); return; } if (Active) { IRCConnection.SendMessage("A voting is already in progress!"); return; } Clear(); Bomb = TPBomb; ActionType = act; Voters.Add(user, true); Countdown.Enabled = true; IRCConnection.SendMessage($"Voting has started by {user} to \"{voteNames[act]}\"! Enter with '!vote VoteYea ' or '!vote VoteNay '"); }
public Vote(int userId, VoteTypes voteVal) { UserId = userId; vote = voteVal; }