private void Allocate(Int32 nAllocations) { for (var n = 0; n < nAllocations; n++) { Inactive.Push(new T()); // Lazy<T> would defer invocation of initBoard() } }
public void WhenInactiveExecueIsCalledWithNullCommand() { var mockRobot = new Mock <IRobot>(); var mockCalculator = new Mock <ICalculator>(); var inactive = new Inactive(mockRobot.Object, mockCalculator.Object); Assert.Throws <ArgumentException>(() => inactive.Execute(null)); }
/// <summary> /// Fires the <see cref="onInactive"/> and <see cref="Inactive"/> events. /// </summary> private void OnInactive() { if (IsActive) { IsActive = false; onInactive?.Invoke(); Inactive?.Invoke(this, EventArgs.Empty); } }
public void WhenInactiveGetReportIsCalled() { var mockRobot = new Mock <IRobot>(); var mockCalculator = new Mock <ICalculator>(); var inactive = new Inactive(mockRobot.Object, mockCalculator.Object); inactive.GetReport(); mockRobot.Verify(robot => robot.GetReport()); }
private void dccSink_Inactive() { if (Inactive != null) { foreach (InactiveHandler ih in Inactive.GetInvocationList()) { ih(); } } }
public void WhenInactiveExecueIsCalledWithNotNullCommandAndNullPositionIsNull() { var mockRobot = new Mock <IRobot>(); var mockCommand = new Mock <ICommand>(); var mockCalculator = new Mock <ICalculator>(); var inactive = new Inactive(mockRobot.Object, mockCalculator.Object); inactive.Execute(mockCommand.Object); mockCalculator.Verify(calc => calc.GetPositionAndState(It.IsAny <ICommand>())); }
public int OnLogInactive() { foreach (InactiveHandler ih in Inactive.GetInvocationList()) { ih(); } System.Diagnostics.Debug.WriteLine("Inactive"); return(0); }
public void Pop(ref T top) { if (top is null) { throw new ArgumentNullException("Pool.pop() called with null argument"); } Inactive.Push(top); DecActive(); top = DefaultElement; }
public void Write(GamePacketWriter writer) { writer.Write(Completed.Count); Completed.ForEach(q => q.Write(writer)); writer.Write(Inactive.Count); Inactive.ForEach(q => q.Write(writer)); writer.Write(Active.Count); Active.ForEach(q => q.Write(writer)); writer.Write(DailyRandomSeed); }
public async Task WhenCloseAccount() { var entity = await GivenAnActiveAccount() .ForUser(AuthorizedUserId) .SavedInDb(_databaseDriver); GivenUserIsAuthorized(); await WhenUserClosesAccount(entity); ThenShouldExpectStatusCode(HttpStatusCode.NoContent); var result = await _databaseDriver.FindByIdAsync <AccountEntity>(entity.Id, entity.UserId); result.Should().NotBeNull(); result !.Inactive.Should().BeTrue(); }
public T Push() { if (Inactive is null) { throw new ApplicationException("No Inactive Pool"); } if (Inactive.Count == 0) { Allocate(nDefaultAllocation); } var top = Inactive.Pop(); Debug.Assert(top is not null, "Empty Inactive Pool"); IncActive(); return(top); }
// Start is called before the first frame update void Start() { if (PlayerPrefs.GetInt(LeveltoCheck + "_unlocked") == 1 || LeveltoCheck == "") { Active.SetActive(true); Inactive.SetActive(false); levelunlocked = true; } else { Active.SetActive(false); Inactive.SetActive(true); levelunlocked = false; } if (PlayerPrefs.GetString("CurrentLevel") == levelName) { PlayerController.instance.transform.position = transform.position; LSResetPosition.instance.respawnposition = transform.position; } }
// public ImmutableArray<Position> GetPendingForMarginRecalc(string instrument) // { // return WaitingForExecutionOrders.GetOrdersByMarginInstrument(instrument).ToImmutableArray(); // } public bool TryGetOrderById(string orderId, out Order order) { return(Active.TryGetOrderById(orderId, out order) || Inactive.TryGetOrderById(orderId, out order)); }
get => "Y".Equals(Inactive, StringComparison.OrdinalIgnoreCase);
public ImmutableArray <Order> GetAllOrders() { return(Active.GetAllOrders() .Union(Inactive.GetAllOrders()) .Union(InProgress.GetAllOrders()).ToImmutableArray()); }
private void Stop() { _timer.Cancel(); _timer = null; Inactive?.Invoke(this, null); }
private void InitializeInstanceFields() { State = new Inactive(this); }
private static Effect CreateEffect(XElement ele) { if (ele == null) { return(null); } Effect effect = new Effect(); var ssTrigger = ele.Element("trigger-cutscene"); if (ssTrigger != null) { effect.TriggerSlideSceneId = ssTrigger.Attribute("idTarget").Value; } var sTrigger = ele.Element("trigger-scene"); if (sTrigger != null) { effect.TriggerSceneId = sTrigger.Attribute("idTarget").Value; } var convTrigger = ele.Element("trigger-conversation"); if (convTrigger != null) { effect.TriggerConversationId = convTrigger.Attribute("idTarget").Value; if (ssTrigger != null) { } else { } } foreach (var activeEle in ele.Elements("activate")) { Active active = new Active(activeEle.Attribute("flag").Value); effect.SetFlags.Actives.Add(active); } foreach (var inactiveEle in ele.Elements("deactivate")) { Inactive inactive = new Inactive(inactiveEle.Attribute("flag").Value); effect.SetFlags.Inactives.Add(inactive); } var speak = ele.Elements("speak-player"); if (speak != null) { foreach (var spk in speak) { effect.SpeakPlayer.Add(new SpeakPlayer() { Text = spk.Value }); } } return(effect); }