public CommonErrorsForm() { InitializeComponent(); synchronizationContext = SynchronizationContext.Current; files = Directory.GetFiles(Environment.CurrentDirectory + @"..\..\..\ErrorPics"); fileNames = files.Select(file => Path.GetFileName(file)).ToArray(); lstAnswers.DataSource = fileNames.Select(element => element.Replace(".png", "")).ToList(); answerQueue = new AnswerQueue <TrueFalseAnswer>(MinAnswer); AskNextQuestion(); lstAnswers.Click += LstAnswers_Click; StartTimer(); }
public CommonErrorsForm() { InitializeComponent(); synchronizationContext = SynchronizationContext.Current; files = Directory.GetFiles(Environment.CurrentDirectory + @"..\..\..\ErrorPics"); possibleAnswers = files.Select(f => Path.GetFileNameWithoutExtension(f)).ToArray(); lstAnswers.DataSource = possibleAnswers; answerQueue = new AnswerQueue <TrueFalseAnswer>(possibleAnswers.Length); Next(); lstAnswers.Click += LstAnswers_Click; StartTimer(); }
public CommonErrorsForm() { InitializeComponent(); _synchronizationContext = SynchronizationContext.Current; _files = Directory.GetFiles(Environment.CurrentDirectory + @"..\..\..\ErrorPics"); _possibleAnswers = _files.Select(f => Path.GetFileName(f)?.Replace(".png", " ")).ToArray(); lstAnswers.DataSource = _possibleAnswers; _answerQueue = new AnswerQueue <TrueFalseAnswer>(_maxAnswers); Next(); lstAnswers.Click += LstAnswers_Click; StartTimer(); }
public CommonErrorsForm() { InitializeComponent(); synchronizationContext = SynchronizationContext.Current; files = Directory.GetFiles(Environment.CurrentDirectory + @"..\..\..\ErrorPics"); possibleAnswers = new string[] { "missing file", "null instance", "divide by zero" }; lstAnswers.DataSource = possibleAnswers; answerQueue = new AnswerQueue <TrueFalseAnswer>(15); Next(); lstAnswers.Click += LstAnswers_Click; StartTimer(); }
public void ShouldOnlyAllowTenAnswers() { //Arrange var queue = new AnswerQueue <TrueFalseAnswer>(10); //Act for (var i = 0; i < 10 + 1; i++) { queue.Enqueue(new TrueFalseAnswer(true)); } //Assert Assert.IsTrue(queue.Count <= 10); }
public void ShouldOnlyAllowTenAnswers() { //Arrange var size = 10; var stack = new AnswerQueue <TrueFalseAnswer>(size); //Act for (int i = 0; i < size + 1; i++) { stack.Enqueue(new TrueFalseAnswer(true)); } //Assert Assert.IsTrue(stack.Count <= 10); }
public MainWindow() { InitializeComponent(); _synchronizationContext = SynchronizationContext.Current; _files = Directory.GetFiles(Environment.CurrentDirectory + @"..\..\..\ErrorPics"); _possibleAnswers = new[] { "Missing File", "null instance", "divide by zero" }; listBox.ItemsSource = _possibleAnswers; _answerQueue = new AnswerQueue <TrueFalseAnswer>(15); Next(); StartTimer(); }
public void ShouldOnlyAllowTenAnswers() { //Arrange const int size = 10; var queue = new AnswerQueue <TrueFalseAnswer>(size); //Act for (var i = 0; i < size + 1; i++) { queue.Enqueue(new TrueFalseAnswer(true)); } //Assert Assert.True(queue.Count <= 10); }
public void ShouldReturnExpectedAverage() { //Arrange var size = 10; var queue = new AnswerQueue <TrueFalseAnswer>(size); queue.Enqueue(new TrueFalseAnswer(false)); queue.Enqueue(new TrueFalseAnswer(true)); queue.Enqueue(new TrueFalseAnswer(true)); queue.Enqueue(new TrueFalseAnswer(false)); //Act var grade = queue.Grade; //Assert Assert.AreEqual(50, grade); }
public void ShouldForgetAtCapacity() { //Arrange var size = 10; var stack = new AnswerQueue <TrueFalseAnswer>(size); stack.Enqueue(new TrueFalseAnswer(false)); for (var i = 0; i < 10; i++) { stack.Enqueue(new TrueFalseAnswer(true)); } //Act var grade = stack.Grade; //Assert Assert.AreEqual(100, grade); }
public void ShouldForgetAtCapacity() { //Arrange const int size = 10; var queue = new AnswerQueue <TrueFalseAnswer>(size); queue.Enqueue(new TrueFalseAnswer(false)); for (var i = 0; i < 10; i++) { queue.Enqueue(new TrueFalseAnswer(true)); } //Act var grade = queue.Grade; //Assert Assert.Equal(100, grade); }