NUnit.Framework.Assert.NotNull(object, string, params object[])

Here are the examples of the csharp api class NUnit.Framework.Assert.NotNull(object, string, params object[]) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

4 Examples 7

1. Example

View license
[TestCase(typeof(ParallelizableAttribute), PropertyNames.ParallelScope, ParallelScope.Self)]
#if !NETCOREAPP1_1
        [TestCase(typeof(RequiresThreadAttribute), PropertyNames.RequiresThread, true)]
#endif
        public void ConstructWithNoArgs<T>(Type attrType, string propName, T propValue)
        {
            var attr = Reflect.Construct(attrType) as PropertyAttribute;
            Assert.NotNull(attr, "{0} is not a PropertyAttribute", attrType.Name);
            Assert.That(attr.Properties.Get(propName), Is.EqualTo(propValue));
        }

2. Example

View license
[TestCase(typeof(DescriptionAttribute), PropertyNames.Description, "description")]
        [TestCase(typeof(LevelOfParallelismAttribute), PropertyNames.LevelOfParallelism, 7)]
        [TestCase(typeof(MaxTimeAttribute), PropertyNames.MaxTime, 50)]
        [TestCase(typeof(ParallelizableAttribute), PropertyNames.ParallelScope, ParallelScope.Fixtures)]
#if !NETCOREAPP1_1
        [TestCase(typeof(SetCultureAttribute), PropertyNames.SetCulture, "fr-FR")]
        [TestCase(typeof(SetUICultureAttribute), PropertyNames.SetUICulture, "fr-FR")]
        [TestCase(typeof(ApartmentAttribute), PropertyNames.ApartmentState, ApartmentState.MTA)]
        [TestCase(typeof(ApartmentAttribute), PropertyNames.ApartmentState, ApartmentState.STA)]
        [TestCase(typeof(TimeoutAttribute), PropertyNames.Timeout, 50)]
#endif
        public void ConstructWithOneArg<T>(Type attrType, string propName, T propValue)
        {
            var attr = Reflect.Construct(attrType, new object[] { propValue }) as PropertyAttribute;
            Assert.NotNull(attr, "{0} is not a PropertyAttribute", attrType.Name);
            Assert.That(attr.Properties.Get(propName), Is.EqualTo(propValue));
        }

3. Example

View license
private IMethodInfo GetMethodInfo(Type type, string methodName, bool includePrivateMethod = false)
        {
            var typeInfo = GetTypeInfo(type);
            var methodInfo = typeInfo.GetMethod(methodName, includePrivateMethod);
            Assert.NotNull(methodInfo, "Cannot find method {0}.{1}", type.FullName, methodName);
            return methodInfo;
        }

4. Example

View license
private void CallTestMethod(string memberName)
        {
            var test = Activator.CreateInstance(type);
            var method = test.GetType().GetMethod(memberName);
            Assert.NotNull(method, "Invalid test name: {0}", memberName);

            method.Invoke(test, new object[0]);
        }