NUnit.Framework.Assert.DoesNotThrow(NUnit.Framework.TestDelegate)

Here are the examples of the csharp api class NUnit.Framework.Assert.DoesNotThrow(NUnit.Framework.TestDelegate) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

200 Examples 7

1. Example

View license
[Test]
        public void test_information_with_null_name_to_remove_does_not_fail()
        {
            var counts = new CouplingCountAndNameProjection();
            Assert.DoesNotThrow(() => counts.Remove(new TestRunInformation() {Name = null}));
        }

2. Example

View license
[Test, ExpectedException(typeof(AssertionException))]
        public void DoesNotThrowFails()
        {
#if NET_2_0
            Assert.DoesNotThrow(TestDelegates.ThrowsArgumentException);
#else
            Assert.DoesNotThrow( new TestDelegate( TestDelegates.ThrowsArgumentException ) );
#endif
        }

3. Example

View license
[Test]
        public void null_test_information_to_remove_does_not_fail()
        {
            var counts = new CouplingCountAndNameProjection();
            Assert.DoesNotThrow(() => counts.Remove(null));
        }

4. Example

View license
[Test, ExpectedException(typeof(AssertionException))]
        public void DoesNotThrowFails()
        {
#if CLR_2_0 || CLR_4_0
            Assert.DoesNotThrow(TestDelegates.ThrowsArgumentException);
#else
            Assert.DoesNotThrow( new TestDelegate( TestDelegates.ThrowsArgumentException ) );
#endif
        }

5. Example

View license
[Test, ExpectedException(typeof(AssertionException))]
        public void DoesNotThrowFails()
        {
#if NET_2_0
            Assert.DoesNotThrow(TestDelegates.ThrowsArgumentException);
#else
            Assert.DoesNotThrow( new TestDelegate( TestDelegates.ThrowsArgumentException ) );
#endif
        }

6. Example

Project: Sitecore-Courier
Source File: Class1.cs
View license
[Test]
        public void ArgumentParserTest()
        {
            var options = new Options();
            var args = new string[]
            {
                "-s",
                "sourcepath",
                "-t",
                "targetpath",
                "-o",
                "outputfile",
                "-c",
                "configuration",
                "-p",
                "tdsfilepath"
            };
            
            Assert.DoesNotThrow(() => CommandLine.Parser.Default.ParseArguments(args, options));
        }

7. Example

View license
[Test]
        public void ScanConsistency_AtPlus_DoesNotThrow_NotSupportedException()
        {
#pragma warning disable 618
            Assert.DoesNotThrow(()=>new QueryRequest("SELECT * FROM `bucket1_name`;").ScanConsistency(ScanConsistency.AtPlus));
#pragma warning restore 618
        }

8. Example

View license
[Test]
        public void
            When_HeartbeatConfigInterval_Is_Greater_Than_HeartbeatConfigCheckFloor_DoNotThrow_ArgumentOutOfRangeException()
        {
            var clientConfig = new ClientConfiguration
            {
                HeartbeatConfigCheckFloor = 10,
                HeartbeatConfigInterval = 500
            };

            Assert.DoesNotThrow(() => clientConfig.Initialize());
        }

9. Example

Project: Ensconce
Source File: TagDictionaryTests.cs
View license
[Test]
        public void LoadEmptyXmlData()
        {
            Assert.DoesNotThrow(() => new TagDictionary("ident", new Dictionary<TagSource, string> { { TagSource.XmlData, "" } }));
        }

10. Example

View license
[Test]
        public void YesWeCan()
        {
            using (var uow = _context.BeginUnitOfWork())
            {
                uow.Load<Root>("id1");
                uow.Commit();
            }

            using (var uow = _context.BeginUnitOfWork())
            {
                uow.Load<Root>("id2");
                uow.Commit();
            }

            Assert.DoesNotThrow(() => _context.BeginUnitOfWork().Load<Root>("id1").AssociateWith("id2"));
        }

11. Example

Project: Cirqus
Source File: ViewLocators.cs
View license
[Test]
        public void DoesNotCallViewLocatorForIrrelevantEvents()
        {
            _context.AddViewManager(_globalInstanceViewManager);

            Assert.DoesNotThrow(() => _context.Save("id1", new JustAnEvent()));
            Assert.DoesNotThrow(() => _context.Save("id2", new AnotherEvent()));
        }

12. Example

Project: ImTools
Source File: ImHashMapTests.cs
View license
[Test]
        public void Search_for_non_existent_key_should_NOT_throw()
        {
            var tree = ImHashMap<int, int>.Empty
                .AddOrUpdate(1, 1)
                .AddOrUpdate(3, 2);

            Assert.DoesNotThrow(
                () => tree.GetValueOrDefault(2));
        }

13. Example

Project: ImTools
Source File: ImHashMapTests.cs
View license
[Test]
        public void Search_in_empty_tree_should_NOT_throw_TryFind()
        {
            var tree = ImHashMap<int, int>.Empty;

            int result;
            Assert.DoesNotThrow(
                () => tree.TryFind(0, out result));
        }

14. Example

Project: ImTools
Source File: ImHashMapTests.cs
View license
[Test]
        public void Search_for_non_existent_key_should_NOT_throw_TryFind()
        {
            var tree = ImHashMap<int, int>.Empty
                .AddOrUpdate(1, 1)
                .AddOrUpdate(3, 2);

            int result;
            Assert.DoesNotThrow(
                () => tree.TryFind(2, out result));
        }

15. Example

Project: ImTools
Source File: ImHashMapTests.cs
View license
[Test]
        public void Search_in_empty_tree_should_NOT_throw()
        {
            var tree = ImHashMap<int, int>.Empty;

            Assert.DoesNotThrow(
                () => tree.GetValueOrDefault(0));
        }

16. Example

Project: OrigoDB
Source File: AuthorizerTests.cs
View license
[Test]
        public void AcceptsNullPrincipal()
        {
            var target = new Authorizer();
            Assert.DoesNotThrow(() => target.Allows(new object(), null));
        }

17. Example

Project: nmoneys
Source File: CurrencyTester.cs
View license
[Test]
		public void Initialize_AllCurrenciesGetInitialized()
		{
			Assert.DoesNotThrow(Currency.InitializeAllCurrencies);
		}

18. Example

Project: dotless
Source File: EnvFixture.cs
View license
[Test]
        public void RegisteringSingleFunctionInDifferentEnvironmentsWorks() {
            var env = new Env();
            env.AddPlugin(new TestPlugin1());

            Assert.DoesNotThrow(() => {
                var newEnv = new Env();
                newEnv.AddPlugin(new TestPlugin1());
            });
        }

19. Example

Project: DotSpatial
Source File: FeatureSetTests.cs
View license
[Test]
        public void MultiPointSaveAsWorking()
        {
            var vertices = new[] { new Coordinate(10.1, 20.2, 3.3, 4.4), new Coordinate(11.1, 22.2, 3.3, 4.4) };

            var mp = new MultiPoint(vertices.CastToPointArray());
            var f = new Feature(mp);
            var fs = new FeatureSet(f.FeatureType)
            {
                Projection = KnownCoordinateSystems.Geographic.World.WGS1984
            };
            fs.Features.Add(f);
            var fileName = FileTools.GetTempFileName(".shp");
            try
            {
                Assert.DoesNotThrow(() => fs.SaveAs(fileName, true));
            }
            catch (Exception)
            {
                FileTools.DeleteShapeFile(fileName);
            }
        }

20. Example

Project: DotSpatial
Source File: GroupTests.cs
View license
[Test(Description = "Checks that there is no exception when zoom to empty Group (https://github.com/DotSpatial/DotSpatial/issues/796)")]
        public void ZoomToGroupDoesntThrowExceptionsOnZoom()
        {
            var target = new Group();

            // Verify context menu item click
            var menuItem = target.ContextMenuItems.First(_ => _.Name == "Zoom to Group");
            Assert.DoesNotThrow(() => menuItem.ClickHandler(menuItem, EventArgs.Empty));

            // Also verify direct call
            Assert.DoesNotThrow(() => target.ZoomToGroup());
        }

21. Example

Project: DotSpatial
Source File: DataManagerTests.cs
View license
[Test]
        public void DialogReadFilterIsCorrect()
        {
            var ofd = new OpenFileDialog();
            Assert.DoesNotThrow(() => ofd.Filter = new DataManager().DialogReadFilter);
        }

22. Example

Project: DotSpatial
Source File: DataManagerTests.cs
View license
[Test]
        public void DialogWriteFilterIsCorrect()
        {
            var ofd = new SaveFileDialog();
            Assert.DoesNotThrow(() => ofd.Filter = new DataManager().DialogWriteFilter);
        }

23. Example

Project: dotnetdbf
Source File: Test.cs
View license
[Test]
        public void test1()
        {
            Assert.DoesNotThrow(() => { new DBFWriter(); }, "Can't Create empty DBFWriter Object");
        }

24. Example

Project: dotnetdbf
Source File: Test.cs
View license
[Test]
        public void test2()
        {
            Assert.DoesNotThrow(() => { new DBFField(); }, "Can't Create empty DBFWriter Object");
        }

25. Example

Project: EnyimMemcached
Source File: ConfigTest.cs
View license
[TestCase]
		public void NamedConfigurationTestInConstructor()
		{
			Assert.DoesNotThrow(() =>
			{
				using (new MemcachedClient("test/validConfig"))
				{
				};
			});
		}

26. Example

Project: TabulaRasa
Source File: DocxDocumentTests.cs
View license
[Test]
    	public void CanUnprotectNewDocument()
    	{
    		using (var document = new DocxDocument())
    		{
    			Assert.DoesNotThrow(document.Unprotect);
    		}
    	}

27. Example

View license
[Test]
        public void can_create_a_manager_with_zero_inital_segments()
        {
            Assert.DoesNotThrow(() => new global::BufferManager.BufferManager(1024, 1024, 0));
        }

28. Example

Project: gedcomx-csharp
Source File: PersonSearchTests.cs
View license
[Test]
        public void TestSearchPersons()
        {
            GedcomxPersonSearchQueryBuilder query = new GedcomxPersonSearchQueryBuilder()
                .MotherGivenName("Clarissa")
                .FatherSurname("Heaton")
                .MotherSurname("Hoyt")
                .Surname("Heaton")
                .GivenName("Israel")
                .FatherGivenName("Jonathan");

            var state = collection.SearchForPersons(query);

            Assert.DoesNotThrow(() => state.IfSuccessful());
        }

29. Example

View license
[Test]
        public void CheckForExceptionWhenParameterIsNull_GivenNullArgumentExceptionThrownForCorrectParameter_ShouldNotThrowException()
        {
            //---------------Set up test pack-------------------
            const string parameterName = "parameter1";
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            Assert.DoesNotThrow(
                () =>
                ConstructorTestUtils
                    .ShouldExpectNonNullParameterFor
                    <ClassWithConstructorWithSubstitutableParameterThatThrowsCorrectExceptions>(
                        parameterName, typeof(SubstitutableAbstractClass)));
            //---------------Test Result -----------------------
        }

30. Example

Project: PeanutButter
Source File: TestTypeExtensions.cs
View license
[Test]
        public void ShouldNotHaveProperty_GivenInvalidNameOnly_WhenPropertyDoesNotExist_ShouldNotThrow()
        {
            //---------------Set up test pack-------------------
            var sut = typeof(ClassWithAProperty);

            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            Assert.DoesNotThrow(() => sut.ShouldNotHaveProperty("StringProperty"));

            //---------------Test Result -----------------------
        }

31. Example

View license
[Test]
        public void Type_ShouldInheritFromEntityBase_GivenTypeInheritingFromEntityBase_ShouldNotThrow()
        {
            //--------------- Arrange -------------------
            _clearCalled = 1; // work around kludgey test and lazy me

            //--------------- Assume ----------------

            //--------------- Act ----------------------
            Assert.DoesNotThrow(() =>
                Type_ShouldInheritFromEntityBase<SomeEntity>()
            );

            //--------------- Assert -----------------------
        }

32. Example

View license
[Test]
        public void ShouldHaveIDbSetFor_OperatingOnType_WhenDoesHaveIDbSetForRequiredPoco_ShouldNotThrow()
        {
            //---------------Set up test pack-------------------
            var sut = typeof(ISomeContextInterface);

            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            Assert.DoesNotThrow(() => sut.ShouldHaveIDbSetFor<SomePOCO>());

            //---------------Test Result -----------------------
        }

33. Example

View license
[Test]
        public void CheckForExceptionWhenParameterIsNull_GivenInterfaceParameters_AndNullParameterIsNotTheFirstParameter_ShouldNotThroException()
        {
            //---------------Set up test pack-------------------
            const string parameterName = "parameter2";
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            Assert.DoesNotThrow(
                () =>
                ConstructorTestUtils
                    .ShouldExpectNonNullParameterFor
                    <ClassWithConstructorWithMultipleSubstitutableInterfaceParametersThatThrowsCorrectExceptions>(
                        parameterName, typeof(IInterface)));
            //---------------Test Result -----------------------
        }

34. Example

Project: PeanutButter
Source File: TestTypeExtensions.cs
View license
[Test]
        public void ShouldHaveProperty_GivenValidNameOnly_WhenPropertyExists_ShouldNotThrow()
        {
            //---------------Set up test pack-------------------
            var sut = typeof(ClassWithAProperty);

            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            Assert.DoesNotThrow(() => sut.ShouldHaveProperty("IntProperty"));

            //---------------Test Result -----------------------
        }

35. Example

Project: PeanutButter
Source File: TestDateAssert.cs
View license
[Test]
        public void IsInRange_CanGetDatesAsIntegers()
        {
            //---------------Set up test pack-------------------
            var min = new DateTime(2011, 1, 1);
            var max = new DateTime(2022, 2, 2);
            var test = new DateTime(2016, 6, 6);
            
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            Assert.DoesNotThrow(() => DateTimeAssert.IsInRange(test, min.Year, min.Month, min.Day, max.Year, max.Month, max.Day));

            //---------------Test Result -----------------------
        }

36. Example

View license
[Test]
        public void ShouldMatchDataIn_ShouldOperateOnCollectionsOfDifferentTypeButSameShape()
        {
            //--------------- Arrange -------------------
            var left = new[] 
            {
                new { id = 1 }
            };
            var right = new[]
            {
                new { id = 1 }
            };

            //--------------- Assume ----------------

            //--------------- Act ----------------------
            Assert.DoesNotThrow(() => left.ShouldMatchDataIn(right));

            //--------------- Assert -----------------------
        }

37. Example

View license
[Test]
        public void CheckForExceptionWhenParameterIsNull_GivenAbstractParameters_AndNullParameterIsNotTheFirstParameter_ShouldNotThroException()
        {
            //---------------Set up test pack-------------------
            const string parameterName = "parameter2";
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            Assert.DoesNotThrow(
                () =>
                ConstructorTestUtils
                    .ShouldExpectNonNullParameterFor
                    <ClassWithConstructorWithMultipleSubstitutableAbstractParametersThatThrowsCorrectExceptions>(
                        parameterName, typeof(SubstitutableAbstractClass)));
            //---------------Test Result -----------------------
        }

38. Example

View license
[Test]
        public void WhenMigrationsCreateEntitiesButRunBeforeClearsThemOut_ShouldNotFailBecauseOfExistingEntities()
        {
            //---------------Set up test pack-------------------
            using (var db = new TempDBLocalDb())
            {
                //---------------Assert Precondition----------------

                //---------------Execute Test ----------------------
                Assert.DoesNotThrow(() =>
                EntityPersistenceTester.CreateFor<SomeEntityWithDecimalValue>()
                    .WithContext<EntityPersistenceContext>()
                    .WithDbMigrator(cs => new DbSchemaImporter(cs, ENTITY_PERSISTENCE_CONTEXT_WITH_DATA_SQL))
                    .WithSharedDatabase(db)
                    .BeforePersisting((ctx, entity) =>
                    {
                        ctx.EntitiesWithDecimalValues.Clear();
                        ctx.SaveChangesWithErrorReporting();
                    })
                    .ShouldPersistAndRecall()
                );

                //---------------Test Result -----------------------
            }
        }

39. Example

Project: PeanutButter
Source File: TestTypeExtensions.cs
View license
[Test]
        public void
            ShouldHaveNonPublicMethod_OperatingOnType_GivenMethodName_WhenSearchMethodIsNotPublic_ShouldNotThrow()
        {
            //---------------Set up test pack-------------------
            var sut = typeof(ClassForTestingMethodAssertions);
            var search = "MethodB";

            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            Assert.DoesNotThrow(() => sut.ShouldHaveNonPublicMethod(search));

            //---------------Test Result -----------------------
        }

40. Example

View license
[Test]
        public void Construct_DoesNotThrow()
        {
            // test setup

            // pre-conditions

            // execute test
            Assert.DoesNotThrow(() => new EventAggregator());

            // test result
        }

41. Example

View license
[Test]
        public void CheckForExceptionWhenParameterIsNull_GivenParametersImplementingAnInterface_AndNullParameterIsNotTheFirstParameter_ShouldNotThroException()
        {
            //---------------Set up test pack-------------------
            const string parameterName = "parameter2";
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            Assert.DoesNotThrow(
                () =>
                ConstructorTestUtils
                    .ShouldExpectNonNullParameterFor
                    <ClassWithConstructorWithMultipleSubstitutableParametersImplementingAnInterfaceThatThrowsCorrectExceptions>(
                        parameterName, typeof(SubstitutableClassImplementingAnInterface)));
            //---------------Test Result -----------------------
        }

42. Example

Project: PeanutButter
Source File: TestLocalFileSystem.cs
View license
[Test]
        public void Construct_ShouldNotThrow()
        {
            //---------------Set up test pack-------------------

            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            Assert.DoesNotThrow(() => new LocalFileSystem());

            //---------------Test Result -----------------------
        }

43. Example

View license
[Test]
        public void WhenUsingSharedDatabaseAndMigrator_ShouldOnlyMigrateTheFirstTime()
        {
            using (var db = new TempDBLocalDb())
            {
                var sql = ENTITY_PERSISTENCE_CONTEXT_SQL;
                EntityPersistenceTester.CreateFor<SomeEntityWithDecimalValue>()
                    .WithContext<EntityPersistenceContext>()
                    .WithDbMigrator(cs => new DbSchemaImporter(cs, sql))
                    .WithSharedDatabase(db)
                    .ShouldPersistAndRecall();

                // need to clear for the test to work again
                using (var ctx = new EntityPersistenceContext(db.CreateConnection()))
                {
                    ctx.EntitiesWithDecimalValues.Clear();
                    ctx.SaveChangesWithErrorReporting();
                }

                Assert.DoesNotThrow(() =>
                {
                    EntityPersistenceTester.CreateFor<SomeEntityWithDecimalValue>()
                        .WithContext<EntityPersistenceContext>()
                        .WithDbMigrator(cs => new DbSchemaImporter(cs, sql))
                        .WithSharedDatabase(db)
                        .ShouldPersistAndRecall();
                });
            }
        }

44. Example

Project: PeanutButter
Source File: TestAutoLocker.cs
View license
[Test]
        public void Construct_WhenGivenSemaphore_ShouldNotThrow()
        {
            //---------------Set up test pack-------------------

            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            Assert.DoesNotThrow(() => new AutoLocker(new SemaphoreSlim(1, 1)));

            //---------------Test Result -----------------------
        }

45. Example

Project: PeanutButter
Source File: TestAutoLocker.cs
View license
[Test]
        public void Construct_WhenGivenSemaphore_ShouldNotThrow()
        {
            //---------------Set up test pack-------------------

            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            Assert.DoesNotThrow(() => new AutoLocker(new Semaphore(1, 1)));

            //---------------Test Result -----------------------
        }

46. Example

Project: PeanutButter
Source File: TestTypeExtensions.cs
View license
[Test]
        public void ShouldBeAbstract_GivenAbstractType_ShouldNotThrow()
        {
            //---------------Set up test pack-------------------
            var sut = typeof(AbstractThing);
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            Assert.DoesNotThrow(() => sut.ShouldBeAbstract());

            //---------------Test Result -----------------------
        }

47. Example

Project: PeanutButter
Source File: TestTypeExtensions.cs
View license
[Test]
        public void ShouldThrowWhenConstructorParameterIsNull_GivenTypeWhichChecksForNull_ShouldNotThrow()
        {
            //---------------Set up test pack-------------------
            var t = typeof(CannotHaveNullParameter);
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            Assert.DoesNotThrow(() => t.ShouldThrowWhenConstructorParameterIsNull("arg", typeof(string)));

            //---------------Test Result -----------------------
        }

48. Example

Project: PeanutButter
Source File: TestAutoResetter.cs
View license
[Test]
        public void Construct_ShouldTakeTwoActions()
        {
            //---------------Set up test pack-------------------

            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            // ReSharper disable once ObjectCreationAsStatement
            Assert.DoesNotThrow(() => new AutoResetter(() => { }, () => { }));

            //---------------Test Result -----------------------
        }

49. Example

Project: PeanutButter
Source File: TestTypeExtensions.cs
View license
[Test]
        public void ShouldNotImplementWithArguments_WhenTypeDoesNotImplementOtherType_ShouldNotThrow()
        {
            //---------------Set up test pack-------------------
            var t = typeof(DoesNotImplement);
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            Assert.DoesNotThrow(() => t.ShouldNotBeAssignableFrom(typeof(IInterface)));

            //---------------Test Result -----------------------
        }

50. Example

Project: PeanutButter
Source File: TestAutoLocker.cs
View license
[Test]
        public void Construct_WhenGivenMutex_ShouldNotThrow()
        {
            //---------------Set up test pack-------------------

            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            Assert.DoesNotThrow(() => new AutoLocker(new Mutex()));

            //---------------Test Result -----------------------
        }