public ESCharacterRepositoryTests() { _testElasticSearchHelper = TestHook.GetTestElasticSearchHelper(); _elasticClient = _testElasticSearchHelper.GetElasticClient(); _index = "character"; _testElasticSearchHelper.CreateIndex(_index); }
private void FixedUpdate() { try { if (Main.CanUpdate && Main.LocalPlayer.HandsController.Item is Weapon) { if (AimbotOptions.SilentAim && NotHooked) { CreateShotHook = new TestHook(); CreateShotHook.Init(typeof(BallisticsCalculator).GetMethod("CreateShot"), typeof(HookObject).GetMethod("SilentAimHook")); CreateShotHook.Hook(); NotHooked = false; } //Target = Main.Players.Where(p => p.DistanceFromCenter <= AimbotOptions.AimbotFov && p.Distance <= AimbotOptions.Distnace && p.IsOnScreen).OrderBy(p => p.DistanceFromCenter).First(); //if (Target.DistanceFromCenter > AimbotOptions.AimbotFov || !GameUtils.IsPlayerAlive(Target.Player)) // Target = null; Target = GetTarget(); DoAimbot(); AutoShoot(); } } catch { } }
private void FriendList_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { if (e.NewItems != null) { foreach (var friend in e.NewItems.Cast <Friend>()) { FriendList.Add(new FriendViewModel(friend)); } } if (e.OldItems != null) { var list = e.OldItems .Cast <Friend>() .Select(s => new FriendViewModel(s)) .ToList(); foreach (var friend in FriendList.Where(w => list.Any(a => a.FirebaseKey == w.FirebaseKey)).ToList()) { FriendList.Remove(friend); } } TestHook?.NotifyOtherThreads(); }
public void HookSecretCacheTest() { Mock <IAmazonSecretsManager> secretsManager = new Mock <IAmazonSecretsManager>(MockBehavior.Strict); secretsManager.SetupSequence(i => i.GetSecretValueAsync(It.IsAny <GetSecretValueRequest>(), default(CancellationToken))) .ReturnsAsync(secretStringResponse1) .ReturnsAsync(binaryResponse1) .ThrowsAsync(new AmazonSecretsManagerException("This should not be called")); secretsManager.SetupSequence(i => i.DescribeSecretAsync(It.IsAny <DescribeSecretRequest>(), default(CancellationToken))) .ReturnsAsync(describeSecretResponse1) .ReturnsAsync(describeSecretResponse1) .ThrowsAsync(new AmazonSecretsManagerException("This should not be called")); TestHook testHook = new TestHook(); SecretsManagerCache cache = new SecretsManagerCache(secretsManager.Object, new SecretCacheConfiguration { CacheHook = testHook }); for (int i = 0; i < 10; i++) { Assert.Equal(cache.GetSecretString(secretStringResponse1.Name).Result, secretStringResponse1.SecretString); } Assert.Equal(2, testHook.GetCount()); for (int i = 0; i < 10; i++) { Assert.Equal(cache.GetSecretBinary(binaryResponse1.Name).Result, binaryResponse1.SecretBinary.ToArray()); } Assert.Equal(4, testHook.GetCount()); }
public void BasePostSaveCanBeIgnored() { var hook = new TestHook(); hook.PostSave(null, null, null); Assert.True(hook.PostSaveInvoked); }
public void BasePreGetCanBeIgnored() { var hook = new TestHook(); hook.PreGet(null, Guid.Empty); Assert.True(hook.PreGetInvoked); }
public void BasePreGetCanBeIgnored() { var hook = new TestHook(); hook.PreGet(null, Guid.Empty); Assert.True(hook.PreGetHandled); }
public void BasePostGetCanBeIgnored() { var hook = new TestHook(); hook.PostGet(null); Assert.True(hook.PostGetInvoked); }
public void BasePreSaveCanBeIgnored() { var hook = new TestHook(); hook.PreSave(null, null); Assert.True(hook.PreSaveHandled); }
private void BulletPenetration() { if (MiscOptions.BulletPenetration && NotHooked && Main.LocalPlayer.HandsController.Item is Weapon) { BulletPenetrationHook = new TestHook(); BulletPenetrationHook.Init(typeof(BallisticsCalculator).GetMethod("GetAmmoPenetrationPower"), typeof(HookObject).GetMethod("BulletPenetration")); BulletPenetrationHook.Hook(); NotHooked = false; } }
public void CacheHookTest() { String testSecretName = Setup(TestType.SecretString); TestHook testHook = new TestHook(); cache = new SecretsManagerCache(TestBase.Client, new SecretCacheConfiguration { CacheHook = testHook }); String originalSecretString = cache.GetSecretString(testSecretName).Result; }
public void Unhook_ShouldUnhook() { ExecuteInMainThread(() => { var hook = new TestHook(); Player.ServiceMessageDispatcher.Hook(hook); var result = Player.ServiceMessageDispatcher.Unhook(hook); this.AreEqual(ActionResultType.OK, result.ResultType, "Cannot unhook a hook"); }); }
public SqlCharacterRepositoryTests() { // mock _testRelationDatabaseHelper = TestHook.GetTestRelationDatabaseHelper(); _database = "character"; _table = "character"; _connectionHelper = Substitute.For <IConnectionHelper>(); _connectionHelper.Character. Returns(new SqlConnection(_testRelationDatabaseHelper.GetConnectionString(_database))); _testRelationDatabaseHelper.CreateDatabase(this._database); _testRelationDatabaseHelper.CreateTable(_database, _table); }
private async void NavigateRequest_NavigationDeclined(object sender, EventArgs e) { _navigateRequest.NavigationDeclined -= NavigateRequest_NavigationDeclined; _navigateRequest.NavigationAccepted -= NavigateRequest_NavigationAccepted; await _mvxNavigationService.Navigate <ChatViewModel, ChatParameters>(new ChatParameters { Chat = _chat, NavigateRequest = _navigateRequest }); TestHook?.NotifyOtherThreads(); }
/// <summary> /// Transmits a request to the mocked server via the proxy, specifying the /// response text, status, and reason phrase to be returned by the server. /// The method then waits for the response to be returned by the proxy. /// </summary> /// <param name="request">YThe request to be submitted to the proxy.</param> /// <param name="responseText">The text to be returned by the server.</param> /// <param name="statusCode">The HTTP status to be returned by the server.</param> /// <param name="reasonPhrase">The HTTP reason phrase to be returned by the server.</param> /// <param name="headers">Any headers to be included in the server response.</param> /// <param name="hook">The optional test hook.</param> /// <returns>An <see cref="OperationInfo"/> instance describing what happened.</returns> public async Task <OperationInfo> SendAsync( HttpRequestMessage request, string responseText, int statusCode = 200, string reasonPhrase = "OK", List <KeyValuePair <string, string> > headers = null, TestHook hook = null) { OperationInfo opInfo; lock (syncLock) { opInfo = new OperationInfo() { Id = Interlocked.Increment(ref nextOpID), StatusCode = statusCode, ReasonPhrase = reasonPhrase, ResponseText = responseText }; if (headers != null && headers.Count > 0) { opInfo.Headers = new Dictionary <string, string>(StringComparer.InvariantCultureIgnoreCase); foreach (var item in headers) { opInfo.Headers[item.Key] = item.Value; } } operations.Add(opInfo.Id, opInfo); } // OnRequest() uses this to correlate requests received by the // server with the operation info. request.Headers.Add("X-NEON-TEST-ID", opInfo.Id.ToString()); opInfo.ProxyResponse = await client.SendAsync(request); return(opInfo); }
public void ImplementsPreGetIsFalse() { var pipelineHook = new TestHook(); Assert.False(pipelineHook.ImplementsPreGet); }
public void ImplementsPostSaveIsFalse() { var pipelineHook = new TestHook(); Assert.False(pipelineHook.ImplementsPostSave); }
public void BasePostSaveCanBeIgnored() { var hook = new TestHook(); hook.PostSave(null, null, null); Assert.True(hook.PostSaveHandled); }
public void ImplementsPreSaveIsTrue() { var pipelineHook = new TestHook(); Assert.True(pipelineHook.ImplementsPreSave); }
public void BasePostGetCanBeIgnored() { var hook = new TestHook(); hook.PostGet(null); Assert.True(hook.PostGetHandled); }
public void BasePreSaveCanBeIgnored() { var hook = new TestHook(); hook.PreSave(null, null); Assert.True(hook.PreSaveInvoked); }
public void ImplementsPostGetIsTrue() { var pipelineHook = new TestHook(); Assert.True(pipelineHook.ImplementsPostGet); }
public void ImplementsPreSaveIsFalse() { var pipelineHook = new TestHook(); Assert.False(pipelineHook.ImplementsPreSave); }