public async void VerifyGetBatches(Freshness freshness) { Batch matchingBatch = getBatch(testProduct1.Id, freshness); Freshness nonMatchingFreshness = (freshness == Freshness.Fresh) ? Freshness.ExpiringToday : Freshness.Fresh; Batch nonMatchingBach = getBatch(testProduct1.Id, nonMatchingFreshness); List <Batch> list = new List <Batch>(); list.Add(matchingBatch); list.Add(nonMatchingBach); mockDataHandler.Setup(m => m.GetData <Batch>(DataSource.Batches)) .ReturnsAsync(list); IEnumerable <Batch> products = await dataAccess.GetBatches(freshness); Assert.True(products.Count() == 1); Batch b = products.First(); Assert.Equal(testProduct1.Id, b.ProductId); Assert.Equal(matchingBatch.Id, b.Id); mockDataHandler.Verify(m => m.GetData <Batch>(DataSource.Products), Times.Never); mockDataHandler.Verify(m => m.GetData <Batch>(DataSource.Batches), Times.Once); mockDataHandler.Verify(m => m.GetData <Batch>(DataSource.BatchEvents), Times.Never); }
private void oldCheckBox_Checked(object sender, RoutedEventArgs e) { Speech.speakPurge(null); freshness = Freshness.Old; if ((bool)newCheckBox.IsChecked) { newCheckBox.IsChecked = false; } }
private void Window_KeyUp(object sender, KeyEventArgs e) { if (e.Key == Key.N && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) { if (freshness != Freshness.None) { seen[1] = true; Speech.speakPurge(null); Dispatcher.BeginInvoke((ThreadStart) delegate { new Candidate3(candidate, subject, freshness, seen).Show(); }, DispatcherPriority.Normal); Dispatcher.BeginInvoke((ThreadStart) delegate { this.Close(); }, DispatcherPriority.Normal); } else { Speech.speakPurge("Please choose freshness to continue"); } } else if (e.Key == Key.B && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) { Speech.speakPurge(null); backButton_Click(null, null); } else if (e.Key == Key.H && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) { Speech.speakPurge("Test Freshness Selection"); Speech.speakNormal("Press one for new test"); Speech.speakNormal("or Press two for old test"); Speech.speakNormal("Then Press N to continue"); } else if (e.Key == Key.S && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) { Speech.speakPurge(null); signoutButton_Click(null, null); } else if (e.Key == Key.D1 || e.Key == Key.NumPad1) { Speech.speakPurge(null); freshness = Freshness.New; newCheckBox.IsChecked = true; } else if (e.Key == Key.D2 || e.Key == Key.NumPad2) { Speech.speakPurge(null); freshness = Freshness.Old; oldCheckBox.IsChecked = true; } else if (e.Key == Key.C && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) { Speech.changeVoice(); } }
private Test test; //selected test public Candidate3(Candidate candidate, Subject subject, Freshness freshness, bool[] seen) { this.candidate = candidate; this.subject = subject; this.freshness = freshness; this.seen = seen; InitializeComponent(); setWindowProperties(); }
public void VerifyExpired() { Batch b = new Batch(); b.Expiration = DateTime.UtcNow.AddDays(-1); Freshness f = b.Freshness; Assert.IsTrue(f == Freshness.Expired); }
public void VerifyExpiresToday() { Batch b = new Batch(); b.Expiration = DateTime.UtcNow.AddHours(10); Freshness f = b.Freshness; Assert.IsTrue(f == Freshness.ExpiringToday); }
/// <summary> /// Get all Batches in the Inventory which still have available portions and /// have the given Freshness. /// </summary> /// <param name="freshness">Freshness of the batches.</param> /// <returns> /// A Task which will resolve into an IEnumerable of Products. /// </returns> public async Task <IEnumerable <Batch> > GetBatches(Freshness freshness) { IEnumerable <Batch> allBatches = await DataHandler.GetData <Batch>(DataSource.Batches); IEnumerable <Batch> batches = allBatches.Where( b => b.Freshness == freshness ); return(batches); }
public Candidate4(Candidate candidate, Test test, Freshness freshness) { this.candidate = candidate; this.freshness = freshness; InitializeComponent(); InitializeAnswerGrids(); setWindowProperties(); InitializeTestSolver(test); }
public async void VerifyGetBatchesByFreshness(Freshness freshness) { mockAccessService.Setup(a => a.GetBatches(freshness)) .ReturnsAsync(batchList); ActionResult actionResult = await this.controller.GetBatchesByFreshness(freshness); OkObjectResult objResult = Assert.IsType <OkObjectResult>(actionResult); Assert.Equal(200, objResult.StatusCode); mockAccessService.Verify(a => a.GetBatches(freshness), Times.Once); }
/// <summary> /// Add the content of the given batch to the corresponding Dictionary entries. /// </summary> /// <param name="batch"> /// Batch to be added. /// </param> public void AddBatchesToOverview(List <Batch> batches) { batches.ForEach( batch => { Freshness f = batch.Freshness; // Add one Batch to the proper category BatchesByFreshness[f] += 1; // Add the available portions to the proper category PortionsByFreshness[f] += batch.AvailableQuantity; }); }
private bool[] seen; //boolean seen array of windows to speak different messages on windows public Candidate1(Candidate candidate, Subject subject, Freshness freshness, bool[] seen) { this.candidate = candidate; this.subject = subject; this.freshness = freshness; this.seen = seen; InitializeComponent(); setWindowProperties(); checkCheckBoxes(); this.welcomeLabel.Content = "WELCOME " + candidate.UserName; }
internal static string ToSerializedValue(this Freshness value) { switch (value) { case Freshness.Day: return("Day"); case Freshness.Week: return("Week"); case Freshness.Month: return("Month"); } return(null); }
private Batch getBatch(Guid productId, Freshness freshness) { Batch b = Batch.GetInstance(productId, 1000); if (freshness == Freshness.Expired) { b.Expiration = DateTime.UtcNow.AddDays(-7); } else if (freshness == Freshness.ExpiringToday) { b.Expiration = DateTime.UtcNow.AddHours(6); } else { b.Expiration = DateTime.UtcNow.AddDays(7); } return(b); }
private void oldCheckBox_Checked(object sender, RoutedEventArgs e) { Speech.speakPurge(null); freshness = Freshness.Old; if ((bool)newCheckBox.IsChecked) newCheckBox.IsChecked = false; }
private void Window_KeyUp(object sender, KeyEventArgs e) { if (e.Key == Key.N && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) { if (freshness != Freshness.None) { seen[1] = true; Speech.speakPurge(null); Dispatcher.BeginInvoke((ThreadStart)delegate { new Candidate3(candidate, subject, freshness, seen).Show(); }, DispatcherPriority.Normal); Dispatcher.BeginInvoke((ThreadStart)delegate { this.Close(); }, DispatcherPriority.Normal); } else { Speech.speakPurge("Please choose freshness to continue"); } } else if (e.Key == Key.B && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) { Speech.speakPurge(null); backButton_Click(null, null); } else if (e.Key == Key.H && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) { Speech.speakPurge("Test Freshness Selection"); Speech.speakNormal("Press one for new test"); Speech.speakNormal("or Press two for old test"); Speech.speakNormal("Then Press N to continue"); } else if (e.Key == Key.S && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) { Speech.speakPurge(null); signoutButton_Click(null, null); } else if (e.Key == Key.D1 || e.Key == Key.NumPad1) { Speech.speakPurge(null); freshness = Freshness.New; newCheckBox.IsChecked = true; } else if (e.Key == Key.D2 || e.Key == Key.NumPad2) { Speech.speakPurge(null); freshness = Freshness.Old; oldCheckBox.IsChecked = true; } else if (e.Key == Key.C && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) { Speech.changeVoice(); } }
public async Task <ActionResult> GetBatchesByFreshness([FromRoute] Freshness freshness) { IEnumerable <Batch> batches = await AccessService.GetBatches(freshness); return(Ok(batches)); }
//Конструктор public Flower(int price, Freshness fresh, int stem) { Price = price; Fresh = fresh; StemLength = stem; }
//Конструктор public Iris(int price, Freshness fresh, int stem) : base(0, fresh, stem) { Price = price; }