public void ShouldGetTestInputsInSameOrderWhenTrainingOrderSetToRandom() { var sensor = new BitmapPicture2DSensor(Default.AutomaticSize, Default.AutomaticSize, 0, 1, TrainingOrder.Random); sensor.AddTestFolder(TrainingSetPath); var nbInputs = 0; var categories = new List<string>(); foreach (var input in sensor.GetTestInputs()) { Assert.IsNotNull(input.CurrentFile); //Debug.WriteLine(input.CurrentFile); Assert.IsFalse(string.IsNullOrWhiteSpace(input.CategoryName)); categories.Add(input.CategoryName); foreach (var iteration in input) { nbInputs++; } } Assert.AreEqual(TrainingSetSize, nbInputs); // Compare with normal order sequence var normalCategories = new List<string>(); var normalSensor = new BitmapPicture2DSensor(Default.AutomaticSize, Default.AutomaticSize, 0, 1, TrainingOrder.Normal); normalSensor.AddTestFolder(TrainingSetPath); foreach (var input in normalSensor.GetTestInputs(false)) { normalCategories.Add(input.CategoryName); } Assert.IsTrue(categories.SequenceEqual(normalCategories)); }
public void ShouldGetTestInputsInNormalAlphabeticalOrder() { var sensor = new BitmapPicture2DSensor(); sensor.AddTestFolder(TrainingSetPath); var nbInputs = 0; var prevInput = ""; foreach (var input in sensor.GetTestInputs()) { Assert.IsNotNull(input.CurrentFile); Assert.IsFalse(string.IsNullOrWhiteSpace(input.CategoryName)); Assert.IsTrue(input.CurrentFile.Name.CompareTo(prevInput) > 0); prevInput = input.CurrentFile.Name; foreach (var iteration in input) { nbInputs++; } } Assert.AreEqual(TrainingSetSize, nbInputs); }