Beispiel #1
0
        public void InvalidateCompoundAminoAcidAdd()
        {
            CompoundAminoAcid aminoAcid = null;

            try
            {
                aminoAcid = new CompoundAminoAcid('A', "Item");
                aminoAcid.Add(null as ISequenceItem, 35);
                Assert.Fail();
            }
            catch (ArgumentException)
            {
                ApplicationLog.WriteLine(
                    "CompoundAminoAcid : Successfully validated the exception");
                Console.WriteLine(
                    "CompoundAminoAcid : Successfully validated the exception");
            }

            finally
            {
                if (aminoAcid != null)
                {
                    ((IDisposable)aminoAcid).Dispose();
                }
            }
            try
            {
                List <ISequenceItem> seq = new List <ISequenceItem>();
                seq.Add(new Sequence(Alphabets.Protein, "a")[0]);
                seq.Add(new Sequence(Alphabets.Protein, "a")[0]);

                List <double> weight = new List <double>();
                weight.Add(80);
                weight.Add(78);

                aminoAcid = new CompoundAminoAcid(
                    1, 'B', Constants.CompoundItemName,
                    false, false, seq, weight);

                Assert.Fail();
            }
            catch (ArgumentException)
            {
                ApplicationLog.WriteLine(
                    "CompoundAminoAcid : Successfully validated the exception");
                Console.WriteLine(
                    "CompoundAminoAcid : Successfully validated the exception");
            }
            finally
            {
                if (aminoAcid != null)
                {
                    ((IDisposable)aminoAcid).Dispose();
                }
            }
        }
Beispiel #2
0
        public void ValidateCompoundAminoAcidNegWeight()
        {
            ICompoundSequenceItem seqItem =
                new CompoundAminoAcid('B', "NegativeWeight");

            seqItem.Add(new Sequence(Alphabets.Protein, "KIET")[0], -35);
            Assert.AreEqual("Lysine", seqItem.SequenceItems[0].Name);
            ApplicationLog.WriteLine(
                "CompoundSequenceP2TestCases : Successfully validated the negative weight expression");
            Console.WriteLine(
                "CompoundSequenceP2TestCases : Successfully validated the negative weight expression");
        }