public void CreateFromFileTest() { Assert.DoesNotThrow(code: () => { _dataset = new BasicTextDataset(textFilePath: "small-test.txt"); }, message: "Dataset failed to initialize from file."); Assert.Throws <IOException>(code: () => { _dataset = new BasicTextDataset(textFilePath: "wrong-filepath.txt"); }, message: "Dataset has been initialized using wrong file path."); var coordinates = _dataset.SpatialCoordinates; var enumerator = coordinates.GetEnumerator(); enumerator.MoveNext(); var sc = enumerator.Current; Assert.AreEqual(expected: 1, actual: sc.X, message: "Spatial coordinates differ"); Assert.AreEqual(expected: 1, actual: sc.Y, message: "Spatial coordinates differ"); Assert.AreEqual(expected: 0, actual: sc.Z, message: "Spatial coordinates differ"); enumerator.MoveNext(); sc = enumerator.Current; Assert.AreEqual(expected: 2, actual: sc.X, message: "Spatial coordinates differ in second spectrum"); Assert.AreEqual(expected: 1, actual: sc.Y, message: "Spatial coordinates differ in second spectrum"); Assert.AreEqual(expected: 0, actual: sc.Z, message: "Spatial coordinates differ in second spectrum"); Assert.AreEqual(expected: _dataset.GetRawMzArray(), actual: new[] { 899.99, 902.58, 912.04 }, message: "The m/zs differ"); Assert.AreEqual(expected: _dataset.GetRawIntensityArray(spectrumIdx: 0), actual: new[] { 12.0, 20.0, 0.0 }, message: "The intensities of first spectrum differs"); }