public void IfItemIsNotNullAddItToTheList()
        {
            var itemUnderTest = new TypeUnderTest{Name="Name", Address= "Address"};
            var listUnderTest = new List<TypeUnderTest>();

            listUnderTest.AddIfNotNull(itemUnderTest);

            Assert.IsTrue(listUnderTest.Contains(itemUnderTest));
        }
예제 #2
0
 public IEnumerable <IMethodInfo> EnumerateTestMethods()
 {
     foreach (var method in TypeUnderTest.GetMethods())
     {
         if (IsTestMethod(method))
         {
             yield return(method);
         }
     }
 }
예제 #3
0
        /// <summary>
        /// Validate the type under test before any actual operation is done.
        ///
        /// Exception will be thrown if the validation failed. The thrown exception
        /// is expected be caught in external frame.
        /// </summary>
        private void ValidateTypeUnderTest()
        {
            // check framework attribute
            if (NuwaTestClassCommand.GetNuwaFrameworkAttr(this) == null)
            {
                throw new InvalidOperationException(
                          string.Format(
                              "The test class must be marked by {0}.",
                              typeof(NuwaFrameworkAttribute).Name));
            }

            // check configuration method attribute
            var configMethodAttr = TypeUnderTest.GetCustomAttributes <NuwaConfigurationAttribute>();

            if (configMethodAttr.Length > 1)
            {
                throw new InvalidOperationException(
                          string.Format("More than two methods are marked by {0}.", typeof(NuwaConfigurationAttribute).Name));
            }
        }
예제 #4
0
파일: Specs.cs 프로젝트: snickroger/Totem
 public IEnumerable <IMethodInfo> EnumerateTestMethods()
 {
     return(TypeUnderTest.GetMethods().Where(IsTestMethod));
 }
예제 #5
0
 public IEnumerable <IMethodInfo> EnumerateTestMethods()
 {
     return(from method in TypeUnderTest.GetMethods()
            where IsTestMethod(method)
            select method);
 }