예제 #1
0
        public void AppendFromFileTest()
        {
            var spectreCountBeforeAppend = _dataset.SpectrumCount;

            Assert.DoesNotThrow(code: () => { _dataset.AppendFromFile(filePath: "small-test.txt"); },
                                message: "The file wasn't successfully appended");

            Assert.AreEqual(expected: spectreCountBeforeAppend + 4,
                            actual: _dataset.SpectrumCount,
                            message: "Append didn't manage to include all spectras");

            Assert.AreEqual(expected: 10,
                            actual: _dataset.GetRawIntensityValue(spectrumIdx: 5, valueIdx: 1),
                            message: "The value of added intensity differs from expected");

            var spatialCoordinates = _dataset.SpatialCoordinates;
            var enumerator         = spatialCoordinates.GetEnumerator();

            for (var i = 0; i < (spectreCountBeforeAppend + 1); i++)
            {
                enumerator.MoveNext();
            }

            Assert.AreEqual(expected: 1.0,
                            actual: enumerator.Current.X,
                            message: "The spatial coordinate of X wasn't appended properly");
            Assert.AreEqual(expected: 1.0,
                            actual: enumerator.Current.Y,
                            message: "The spatial coordinate of Y wasn't appended properly");
            Assert.AreEqual(expected: 0.0,
                            actual: enumerator.Current.Z,
                            message: "The spatial coordinate of Z wasn't appended properly");
        }