internal void Prepare(string initString) { b = new Bilge(tl: System.Diagnostics.TraceLevel.Verbose); b.AddHandler(new TCPHandler("127.0.0.1", 9060)); b.Verbose.Log(initString); }
public void ObjectDump_WritesObjectContents() { #if ACTIVEDEBUG var ied = new IEmergencyDiagnostics(); #else var ied = new MockEmergencyDiagnostics(); #endif try { ied.Log("START OD"); TestObject to = new TestObject(); to.stringvalue = "arfle barfle gloop"; Bilge sut = TestHelper.GetBilgeAndClearDown(); ied.Log("Before Anything Done"); var mmh = new MockMessageHandler(); sut.AddHandler(mmh); sut.Info.Dump(to, "context"); ied.Log("FLUSH OD"); sut.Flush(); ied.Log("FlushAfter OD"); mmh.SetMustContainForBody("arfle barfle gloop"); ied.Log("ASSERT OD"); mmh.AssertAllConditionsMetForAllMessages(true, true); } finally { ied.Log("END OD"); ied.Shutdown(); } }
private void WriteASeriesOfMessages(Bilge b) { b.Info.Log("Test message"); b.Verbose.Log("test message"); b.Error.Log("Test message"); b.Warning.Log("Test message"); }
public override void OnCombo() { if (IsSpellActive("Q") && Menu.Item("Misc_Q_Always").GetValue <bool>() && Q.IsReady()) { Q.Cast(); } if (IsSpellActive("E")) { Cast_E(); } var Q_Target = SimpleTs.GetTarget(Q.Range, SimpleTs.DamageType.Physical); if (Q_Target != null) { if (IsSpellActive("Use Botrk")) { if (Bilge.IsReady() && (GetComboDamage(Q_Target) + MyHero.GetAutoAttackDamage(Q_Target) * 6 < Q_Target.Health || GetHealthPercent() < 35)) { Use_Bilge(Q_Target); } if (Botrk.IsReady() && (GetComboDamage(Q_Target) + MyHero.GetAutoAttackDamage(Q_Target) * 6 < Q_Target.Health || GetHealthPercent() < 35)) { Use_Botrk(Q_Target); } } } if (IsSpellActive("R")) { Cast_R(); } }
private void StandardLogOnMainThread(Bilge useThis) { for (int i = 0; i < MESSAGESTOSEND; i++) { useThis.Info.Log($"ITs a random message {i}"); } }
public UseCaseTests() { Bilge.AddHandler(new TCPHandler("127.0.0.1", 9060), HandlerAddOptions.SingleType); Bilge.SetConfigurationResolver((nm, lvl) => { return(System.Diagnostics.SourceLevels.Verbose); }); }
public void PerformUpdate(string fl, FileUpdateType fut) { string versonToWrite = cv.GetVersionString(cv.GetDisplayType(fut)); Bilge.VerboseLog($"Perform update requested {versonToWrite} using {fut.ToString()}", fl); switch (fut) { case FileUpdateType.Assembly4: case FileUpdateType.Assembly2: UpdateCSFileWithAttribute(fl, ASMFILE_VER_TAG, versonToWrite); break; case FileUpdateType.AssemblyInformational: UpdateCSFileWithAttribute(fl, ASMFILE_INFVER_TAG, versonToWrite); break; case FileUpdateType.AssemblyFile: UpdateCSFileWithAttribute(fl, ASMFILE_FILEVER_TAG, versonToWrite); break; case FileUpdateType.Wix: Bilge.Log("Wix Updates NOT SUPPORTED"); break; default: break; } }
/// [Trait(Traits.Age, Traits.Fresh)] //[Trait(Traits.Style, Traits.Unit)] public void MessageBatching_Works_Enabled() { const int MESSAGE_BATCHSIZE = 10; Bilge sut = TestHelper.GetBilgeAndClearDown(); sut.SetMessageBatching(MESSAGE_BATCHSIZE, 500000); sut.ActiveTraceLevel = SourceLevels.Information; var mmh = new MockMessageHandler(); sut.AddHandler(mmh); for (int i = 0; i < 100; i++) { sut.Info.Log("Dummy Message"); if (i % 25 == 0) { //Thread.Sleep(100); // The flush forces the write, this is needed otherwise it bombs through // too fast for more than one write to the handler to occur. sut.Flush(); } if (mmh.TotalMessagesRecieved > 0) { // Any time that we get a batch it must be at least MESSAGE_BATCHSIZE msgs. Assert.True(mmh.LastMessageBatchSize >= MESSAGE_BATCHSIZE, $"Batch Size NotBig Enough at {i} batch Size {mmh.LastMessageBatchSize}"); } } }
private float GetComboDamage(Obj_AI_Base target) { double comboDamage = (float)MyHero.GetComboDamage(target, GetSpellCombo()); if (R.IsReady()) { comboDamage += MyHero.GetSpellDamage(target, SpellSlot.R) * 4; } if (Bilge.IsReady()) { comboDamage += MyHero.GetItemDamage(target, Damage.DamageItems.Bilgewater); } if (Botrk.IsReady()) { comboDamage += MyHero.GetItemDamage(target, Damage.DamageItems.Botrk); } if (Ignite != SpellSlot.Unknown && MyHero.SummonerSpellbook.CanUseSpell(Ignite) == SpellState.Ready) { comboDamage += MyHero.GetSummonerSpellDamage(target, Damage.SummonerSpell.Ignite); } return((float)(comboDamage + MyHero.GetAutoAttackDamage(target) * 4)); }
public UseCaseTests() { Bilge.AddMessageHandler(new TCPHandler("127.0.0.1", 9060)); Bilge.SetConfigurationResolver((a, b) => { return(System.Diagnostics.SourceLevels.Verbose); }); }
private void MultiLogOnMainThread(Bilge useThis) { for (int i = 0; i < MESSAGESTOSEND; i++) { useThis.Info.Log($"ITs a random message {i}"); useThis.Verbose.Log($"Again {i}", "With sEcondary"); } }
public void VersionUnit_ChangeBehavour_ExceptionIfNotIncrementable() { Bilge.Log(nameof(VersionUnit_ChangeBehavour_ExceptionIfNotIncrementable) + " Entered"); var sut = new VersionUnit("monkey"); Assert.Throws <InvalidOperationException>(() => { sut.SetBehaviour(VersionIncrementBehaviour.AutoIncrementWithReset); }); }
public void SourceLevel_ContstrucorVerboseIncludesSubLevels1() { Bilge b = new Bilge(tl: SourceLevels.Verbose); Assert.True((b.ActiveTraceLevel & SourceLevels.Verbose) == SourceLevels.Verbose); Assert.True((b.ActiveTraceLevel & SourceLevels.Information) == SourceLevels.Information); Assert.True((b.ActiveTraceLevel & SourceLevels.Error) == SourceLevels.Error); }
public VersioningTask() { Bilge.CurrentTraceLevel = System.Diagnostics.TraceLevel.Verbose; Bilge.Log("PliskyVersioning Online."); Bilge.QueueMessages = false; Bilge.EnableEnhancements = true; Bilge.CustomTagReplacementHandler = LogMessageIntercept; }
public void AddUpdateType(string minmatchPattern, FileUpdateType updateToPerform) { Bilge.VerboseLog("Adding Update Type " + minmatchPattern); if (!pendingUpdates.ContainsKey(minmatchPattern)) { pendingUpdates.Add(minmatchPattern, new List <FileUpdateType>()); } pendingUpdates[minmatchPattern].Add(updateToPerform); }
public void Assert_False_DoesNothingIfFalse() { var mmh = new MockMessageHandler(); Bilge sut = new Bilge(); sut.AddHandler(mmh); sut.Assert.True(true); Assert.Equal(0, mmh.AssertionMessageCount); }
public void Action_RegisterHandler_Works() { Bilge sut = TestHelper.GetBilgeAndClearDown(); bool res = sut.Action.RegisterHandler((x) => { }, "default"); Assert.True(res); }
public void AddHandler_SingleType_AddsDifferentTypes() { _ = TestHelper.GetBilgeAndClearDown(); Bilge.AddHandler(new MockMessageHandler(), HandlerAddOptions.SingleType); Bilge.AddHandler(new InMemoryHandler(), HandlerAddOptions.SingleType); var ct = Bilge.GetHandlers().Count(); Assert.Equal(2, ct); }
public void AddHandler_SingleName_DoesNotAddSecondName() { _ = TestHelper.GetBilgeAndClearDown(); Bilge.AddHandler(new MockMessageHandler("arfle"), HandlerAddOptions.SingleName); Bilge.AddHandler(new MockMessageHandler("arfle"), HandlerAddOptions.SingleName); var ct = Bilge.GetHandlers().Count(); Assert.Equal(1, ct); }
public void VerboseNotLogged_IfNotVerbose() { MockMessageHandler mmh = new MockMessageHandler(); Bilge b = TestHelper.GetBilgeAndClearDown(setTrace: false); b.ActiveTraceLevel = SourceLevels.Information; b.AddHandler(mmh); b.Verbose.Log("Msg"); Assert.Equal <int>(0, mmh.TotalMessagesRecieved); }
public void AddHandler_SingleName_AddsDifferentNames() { _ = TestHelper.GetBilgeAndClearDown(); Bilge.AddHandler(new MockMessageHandler("arfle"), HandlerAddOptions.SingleName); Bilge.AddHandler(new MockMessageHandler("barfle"), HandlerAddOptions.SingleName); var ct = Bilge.GetHandlers().Count(); Assert.Equal(2, ct); }
public void AddHandler_DoesAddHandler() { _ = TestHelper.GetBilgeAndClearDown(); bool worked = Bilge.AddHandler(new MockMessageHandler()); var count = Bilge.GetHandlers().Count(); Assert.True(worked); Assert.Equal(1, count); }
public void Action_RegisterHandlerTwice_Fails() { Bilge sut = TestHelper.GetBilgeAndClearDown(); bool res1 = sut.Action.RegisterHandler((x) => { }, "default"); bool res2 = sut.Action.RegisterHandler((x) => { }, "default"); Assert.False(res2); }
public void Action_CallCount_StartsAtOne() { Bilge sut = TestHelper.GetBilgeAndClearDown(); _ = sut.Action.RegisterHandler((x) => { Assert.Equal(1, x.CallCount); }, "default"); sut.Action.Occured("test", "dummy"); }
public void GetHandlers_FilterReturnsNamed() { _ = TestHelper.GetBilgeAndClearDown(); Bilge.AddHandler(new MockMessageHandler("arfle")); Bilge.AddHandler(new MockMessageHandler("barfle")); var count = Bilge.GetHandlers("arf*").Count(); Assert.Equal(1, count); }
public CompleteVersion() { Bilge.Log("Complete Version Created"); displayTypes = new DisplayType[NUMBERDISPLAYTYPES]; displayTypes[(int)FileUpdateType.Assembly4] = DisplayType.Full; displayTypes[(int)FileUpdateType.AssemblyInformational] = DisplayType.FullIncludeText; displayTypes[(int)FileUpdateType.AssemblyFile] = DisplayType.Full; displayTypes[(int)FileUpdateType.Wix] = DisplayType.FullIncludeText; displayTypes[(int)FileUpdateType.Assembly2] = DisplayType.Short; }
private void PerformMessageTestBatchOff(int mc) { Bilge useThis = new Bilge(); useThis.DisableMessageBatching(); for (int i = 0; i < mc; i++) { useThis.Info.Log($"Tis is the message that is averagely log {i}"); } }
private void PerformMessageTestBatchLarge(int mc) { Bilge useThis = new Bilge(); useThis.SetMessageBatching(1000, 10000); for (int i = 0; i < mc; i++) { useThis.Info.Log($"Tis is the message that is averagely log {i}"); } }
/// <summary> /// Inject a new instance of bilge, or change the trace level of the current instance. To set the trace level ensure that /// the first parameter is null. To set bilge simply pass a new instance of bilge. /// </summary> /// <param name="blg">An instance of Bilge to use inside this Hub</param> /// <param name="tl">If specified and blg==null then will alter the tracelevel of the current Bilge</param> public void InjectBilge(Bilge blg, TraceLevel tl = TraceLevel.Off) { if (blg != null) { b = blg; } else { b.CurrentTraceLevel = tl; } }
public void InjectBilge_Success() { b.Info.Flow(); var sut = new MockBd2GenealBase(); Bilge mockBilge = new Bilge(); sut.InjectBilge(mockBilge); Assert.Same(mockBilge, sut.GetAssignedBilge()); }