i wanted to know how to i test a metho as below

    int32[] AT;
    int32[] at;

    public void A()

            AT = at;
            AB = ab;

    is this correct

      public void SetStaticTest1()
                Int32[] AT ;
                Int32[] at = {1,2,3,4,5};
                Int32 AB ;
                Int32 ab = 4;

                AT = at;
                AB = ab;

                Assert.Equals(AB, ab);

this gives an  fail in test 
    can some one give me the way to do testint in C#


Recommended Answers

All 6 Replies

hi anybody know the reason for this

how do i write an assert to equal int32[] variables?

does nyone know how to solve this

hi anyone know the answer for this

Give your variables meaningfull names.
A method that retruns void has no need for a return statement.

        public void SetStaticTest1()

            TreeType Type = new TreeType(); // TODO: Initialize to an appropriate value

            InflateTree target = new InflateTree(TreeType.BitLen); // TODO: Initialize to an appropriate value
            InflateTree actual = new InflateTree(TreeType.BitLen);


            Assert.AreNotEqual(target, actual); //check whether the objects are equal
            Assert.AreEqual(target.,actual.);//here i am trying to get target.ActiveTree , since it is a private variable i can't access it so how do i test it???


class InflateTree{
public Int32[] ActiveTree;
        public Int32 ActiveBitMask;
        private Int32[] StaticTree;
        private Int32 StaticBitMask

//has a case statement which assigned values to the public variables
  public void SetStatic()
            ActiveTree = StaticTree;      //is a private variable and StaticTree is a static variable same for the blow line also
            ActiveBitMask = StaticBitMask;


what i am trying to do is to compare the values of both the public and private variable in the assert.
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.