|
9 | 9 | using Transcriptomics.Digestion; |
10 | 10 | using Transcriptomics; |
11 | 11 | using Omics; |
| 12 | +using MassSpectrometry; |
| 13 | +using Omics.Fragmentation; |
12 | 14 |
|
13 | 15 | namespace Test.Transcriptomics |
14 | 16 | { |
@@ -171,5 +173,32 @@ public static void TestInequality_SameParentAndDigestionProduct_DifferentRnases( |
171 | 173 | Assert.That(oligo1, Is.Not.EqualTo((object)oligo2)); |
172 | 174 | Assert.That(oligo1.GetHashCode(), Is.Not.EqualTo(oligo2.GetHashCode())); |
173 | 175 | } |
| 176 | + |
| 177 | + [Test] |
| 178 | + public static void Fragment_WorksWhenParentIsNull() |
| 179 | + { |
| 180 | + // Arrange: create an OligoWithSetMods with no parent (using the string constructor) |
| 181 | + var baseSequence = "GUACUG"; |
| 182 | + var mod = TestDigestion.PotassiumAdducts[1]; |
| 183 | + var modDict = new Dictionary<string, Modification> { { mod.IdWithMotif, mod } }; |
| 184 | + var oligo = new OligoWithSetMods(baseSequence, modDict); |
| 185 | + |
| 186 | + // Confirm parent is null |
| 187 | + Assert.That(oligo.Parent == null); |
| 188 | + |
| 189 | + // Act: call Fragment |
| 190 | + var products = new List<Product>(); |
| 191 | + oligo.Fragment(DissociationType.CID, FragmentationTerminus.Both, products); |
| 192 | + |
| 193 | + // Assert: products are generated and not empty |
| 194 | + Assert.That(products, Is.Not.Null); |
| 195 | + Assert.That(products.Count, Is.GreaterThan(0), "Fragment should generate at least one product when parent is null."); |
| 196 | + |
| 197 | + // Optionally, check that all products are for the correct sequence length |
| 198 | + foreach (var product in products) |
| 199 | + { |
| 200 | + Assert.That(product.NeutralMass, Is.GreaterThan(0), "Product neutral mass should be positive."); |
| 201 | + } |
| 202 | + } |
174 | 203 | } |
175 | 204 | } |
0 commit comments