Ejemplo n.º 1
0
        public void ConstructWithArray()
        {
            int[]            array  = new int[] { 1, 2, 3 };
            CollectionDomain domain = new CollectionDomain(array);

            CollectionAssert.AreElementsEqual(array, domain);
        }
 public void BoundaryOfCollectionWithTwoElement()
 {
     int[] array = new int[] { 1,2 };
     CollectionDomain domain = new CollectionDomain(array);
     IDomain boundary = domain.Boundary;
     CollectionAssert.AreElementsEqual(array, boundary);
 }
 public void BoundaryOfCollectionWithMoreThanTwoElement()
 {
     int[] array = new int[] { 1, 2,3,4,5,6 };
     int[] barray = new int[] { 1, 6 };
     CollectionDomain domain = new CollectionDomain(array);
     IDomain boundary = domain.Boundary;
     CollectionAssert.AreElementsEqual(barray, boundary);
 }
Ejemplo n.º 4
0
        public void BoundaryOfCollectionWithTwoElement()
        {
            int[]            array    = new int[] { 1, 2 };
            CollectionDomain domain   = new CollectionDomain(array);
            IDomain          boundary = domain.Boundary;

            CollectionAssert.AreElementsEqual(array, boundary);
        }
Ejemplo n.º 5
0
        public void BoundaryOfCollectionWithMoreThanTwoElement()
        {
            int[]            array    = new int[] { 1, 2, 3, 4, 5, 6 };
            int[]            barray   = new int[] { 1, 6 };
            CollectionDomain domain   = new CollectionDomain(array);
            IDomain          boundary = domain.Boundary;

            CollectionAssert.AreElementsEqual(barray, boundary);
        }
        /// <summary>
        /// Gets the set of values (the collection of domains) for the parameter.
        /// </summary>
        /// <param name="domains">The <see cref="IDomainCollection"/> the values generated by the source of data</param>
        /// <param name="parameter"><see cref="ParameterInfo"/> for the parameter that wants the values.</param>
        /// <param name="fixture">The test fixture.</param>
        /// <remarks>See <a href="http://blog.dotnetwiki.org/CombinatorialTestingWithTestFu1.aspx">here</a> for more on
        /// domain generation</remarks>
        public override void GetDomains(IDomainCollection domains, ParameterInfo parameter, object fixture) {
            ArrayList types = new ArrayList();
            foreach (Type type in typeFromAssembly.Assembly.GetExportedTypes()) {
                if (type.IsAbstract || type.IsInterface || !type.IsClass)
                    continue;

                if (!parameter.ParameterType.IsAssignableFrom(type))
                    continue;

                // create instance
                Object instance = TypeHelper.CreateInstance(type);
                types.Add(instance);
            }

            CollectionDomain domain = new CollectionDomain(types);
            domain.Name = typeFromAssembly.Assembly.GetName().Name;
            domains.Add(domain);
        }
        public override void GetDomains(IDomainCollection domains, ParameterInfo parameter, object fixture)
        {
            bool isString = parameter.ParameterType.IsAssignableFrom(typeof(string));
            ArrayList data = new ArrayList();
            foreach (string memberName in this.Values.Split(';'))
            {
                object cresult = null;
                if (isString)
                    cresult = memberName.ToString();
                else
                    cresult = Convert.ChangeType(memberName, parameter.ParameterType);
                data.Add(cresult);
            }
            if (data.Count == 0)
                return;

            CollectionDomain domain = new CollectionDomain(data);
            domains.Add(domain);
        }
 public void ConstructWithArray()
 {
     int[] array = new int[] { 1, 2, 3 };
     CollectionDomain domain = new CollectionDomain(array);
     CollectionAssert.AreElementsEqual(array, domain);
 }