NUnit.Framework.Assert.GreaterOrEqual(int, int)

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

86 Examples 7

1. Example

Project: AutoTest.Net
Source File: GreaterEqualFixture.cs
View license
[Test]
		public void GreaterOrEqual_Int32()
		{
			Assert.GreaterOrEqual(i1, i1);           
			Assert.GreaterOrEqual(i1, i2);
		}

2. Example

Project: nunit
Source File: GreaterEqualFixture.cs
View license
[Test]
        public void GreaterOrEqual_Int32()
        {
            Assert.GreaterOrEqual(i1, i1);           
            Assert.GreaterOrEqual(i1, i2);
        }

3. Example

Project: AutoTest.Net
Source File: GreaterEqualFixture.cs
View license
[Test]
		public void GreaterOrEqual_Int32()
		{
			Assert.GreaterOrEqual(i1, i1);           
			Assert.GreaterOrEqual(i1, i2);
		}

4. Example

View license
[Test]
        public void GetWorkSpaces()
        {
            var t = new WorkspaceService();
            t.List();
            var obj = t.List();

            Assert.GreaterOrEqual(obj.Count(), 0);
        }

5. Example

Project: AutoTest.Net
Source File: GreaterEqualFixture.cs
View license
[Test, ExpectedException(typeof(AssertionException))]
        public void NotGreaterOrEqual()
        {
			expectedMessage =
				"  Expected: greater than or equal to 5" + Environment.NewLine +
				"  But was:  4" + Environment.NewLine;
			Assert.GreaterOrEqual(i2, i1);
        }

6. Example

View license
[Test]
        [TestCase("1/1/2012", "1/1/2013")]
        public void GetTimeEntriesByDateRange(DateTime from, DateTime to)
        {

            var rte = new TimeEntryParams();
            rte.StartDate = from;
            rte.EndDate = to;

            var entries = timeEntrySrv.List(rte);

            Assert.GreaterOrEqual(entries.Count(), 0);

        }

7. Example

Project: AutoTest.Net
Source File: GreaterEqualFixture.cs
View license
[Test]
		public void GreaterOrEqual_Int32()
		{
			Assert.GreaterOrEqual(i1, i1);           
			Assert.GreaterOrEqual(i1, i2);
		}

8. Example

View license
[Test, ExpectedException(typeof(AssertionException))]
        public void NotGreaterOrEqual()
        {
			expectedMessage =
				"  Expected: greater than or equal to 5" + Environment.NewLine +
				"  But was:  4" + Environment.NewLine;
			Assert.GreaterOrEqual(i2, i1);
        }

9. Example

Project: C--Toggl-Api-Client
Source File: ProjectTests.cs
View license
[Test]
        public void Get()
        {
                       
            var srv = new ProjectService();

            var obj = srv.List();

            Assert.GreaterOrEqual(obj.Count(), 0);
        }

10. Example

Project: C--Toggl-Api-Client
Source File: ClientTests.cs
View license
[Test]
        public void List()
        {
            var srv = new ClientService();

            var obj = srv.List();

            Assert.GreaterOrEqual(obj.Count(), 0);
        }

11. Example

Project: AutoTest.Net
Source File: GreaterEqualFixture.cs
View license
[Test, ExpectedException(typeof(AssertionException))]
        public void NotGreaterOrEqual()
        {
			expectedMessage =
				"  Expected: greater than or equal to 5" + Environment.NewLine +
				"  But was:  4" + Environment.NewLine;
			Assert.GreaterOrEqual(i2, i1);
        }

12. Example

View license
[Test]
		public void GreaterOrEqual_Int32()
		{
			Assert.GreaterOrEqual(i1, i1);           
			Assert.GreaterOrEqual(i1, i2);
		}

13. Example

View license
[Test, ExpectedException(typeof(AssertionException))]
        public void NotGreaterOrEqual()
        {
			expectedMessage =
				"  Expected: greater than or equal to 5" + Environment.NewLine +
				"  But was:  4" + Environment.NewLine;
			Assert.GreaterOrEqual(i2, i1);
        }

14. Example

View license
[Test]
        public void GetTimeEntries()
        {
            var entries = timeEntrySrv.List();
            Assert.GreaterOrEqual(entries.Count(), 0);    
        }

15. Example

View license
[Test, ExpectedException(typeof(AssertionException))]
        public void NotGreaterOrEqual()
        {
			expectedMessage =
				"  Expected: greater than or equal to 5" + Environment.NewLine +
				"  But was:  4" + Environment.NewLine;
			Assert.GreaterOrEqual(i2, i1);
        }

16. Example

View license
[Test]
		public void GreaterOrEqual_Int32()
		{
			Assert.GreaterOrEqual(i1, i1);           
			Assert.GreaterOrEqual(i1, i2);
		}

17. Example

View license
[Test]
		public void GreaterOrEqual_Int32()
		{
			Assert.GreaterOrEqual(i1, i1);           
			Assert.GreaterOrEqual(i1, i2);
		}

18. Example

Project: AutoTest.Net
Source File: GreaterEqualFixture.cs
View license
[Test, ExpectedException(typeof(AssertionException))]
        public void NotGreaterOrEqual()
        {
			expectedMessage =
				"  Expected: greater than or equal to 5" + Environment.NewLine +
				"  But was:  4" + Environment.NewLine;
			Assert.GreaterOrEqual(i2, i1);
        }

19. Example

Project: C--Toggl-Api-Client
Source File: TaskTests.cs
View license
[Test]
        public void GetTasks()
        {
            var srv = new TaskService();

            var obj = srv.List();

            Assert.GreaterOrEqual(obj.Count(), 0);
        }

20. Example

Project: AutoTest.Net
Source File: GreaterEqualFixture.cs
View license
[Test]
        public void FailureMessage()
        {
            string msg = null;

            try
            {
                Assert.GreaterOrEqual(7, 99);
            }
            catch (AssertionException ex)
            {
                msg = ex.Message;
            }

            StringAssert.Contains( TextMessageWriter.Pfx_Expected + "greater than or equal to 99", msg);
            StringAssert.Contains( TextMessageWriter.Pfx_Actual + "7", msg);
		}

21. Example

Project: AutoTest.Net
Source File: GreaterEqualFixture.cs
View license
[Test]
        public void FailureMessage()
        {
            string msg = null;

            try
            {
                Assert.GreaterOrEqual(7, 99);
            }
            catch (AssertionException ex)
            {
                msg = ex.Message;
            }

            StringAssert.Contains( TextMessageWriter.Pfx_Expected + "greater than or equal to 99", msg);
            StringAssert.Contains( TextMessageWriter.Pfx_Actual + "7", msg);
		}

22. Example

Project: AutoTest.Net
Source File: GreaterEqualFixture.cs
View license
[Test]
        public void FailureMessage()
        {
            string msg = null;

            try
            {
                Assert.GreaterOrEqual(7, 99);
            }
            catch (AssertionException ex)
            {
                msg = ex.Message;
            }

            StringAssert.Contains( TextMessageWriter.Pfx_Expected + "greater than or equal to 99", msg);
            StringAssert.Contains( TextMessageWriter.Pfx_Actual + "7", msg);
		}

23. Example

View license
[Test]
        public void FailureMessage()
        {
            string msg = null;

            try
            {
                Assert.GreaterOrEqual(7, 99);
            }
            catch (AssertionException ex)
            {
                msg = ex.Message;
            }

            StringAssert.Contains( TextMessageWriter.Pfx_Expected + "greater than or equal to 99", msg);
            StringAssert.Contains( TextMessageWriter.Pfx_Actual + "7", msg);
		}

24. Example

View license
[Test]
        public void FailureMessage()
        {
            string msg = null;

            try
            {
                Assert.GreaterOrEqual(7, 99);
            }
            catch (AssertionException ex)
            {
                msg = ex.Message;
            }

            StringAssert.Contains( TextMessageWriter.Pfx_Expected + "greater than or equal to 99", msg);
            StringAssert.Contains( TextMessageWriter.Pfx_Actual + "7", msg);
		}

25. Example

View license
[Test]
        public void FailureMessage()
        {
            string msg = null;

            try
            {
                Assert.GreaterOrEqual(7, 99);
            }
            catch (AssertionException ex)
            {
                msg = ex.Message;
            }

            StringAssert.Contains( TextMessageWriter.Pfx_Expected + "greater than or equal to 99", msg);
            StringAssert.Contains( TextMessageWriter.Pfx_Actual + "7", msg);
		}

26. Example

Project: duality
Source File: ReflectionHelperTest.cs
View license
[Test] public void VisitorContentRef()
		{
			TestVisitorClass visitedRoot = new TestVisitorClass
			{
				StringField = "Hello World",
				ByteField = 42,
				ShortListField = new List<short> { 0, 1, 2 },
				ContentRefField = new ContentRef<Resource>(null, "ResourceReference"),
				ObjectField = "Hidden"
			};
			int visitedCount;

			// None. We do not have a bool here.
			visitedCount = 0;
			ReflectionHelper.VisitObjectsDeep<bool>(visitedRoot, s => { visitedCount++; return s; });
			Assert.AreEqual(0, visitedCount);

			// Only the byte field
			visitedCount = 0;
			ReflectionHelper.VisitObjectsDeep<byte>(visitedRoot, s => { visitedCount++; return s; });
			Assert.AreEqual(1, visitedCount);

			// At least the three list elements. Probably more due to internal array allocations
			visitedCount = 0;
			ReflectionHelper.VisitObjectsDeep<short>(visitedRoot, s => { visitedCount++; return s; });
			Assert.GreaterOrEqual(visitedCount, 3);

			// Expecting StringField, (hidden) ObjectField and ContentRefField's internal path.
			visitedCount = 0;
			ReflectionHelper.VisitObjectsDeep<string>(visitedRoot, s => { visitedCount++; return s; });
			Assert.AreEqual(3, visitedCount);
		}

27. Example

Project: mathnet-numerics
Source File: ZipfTests.cs
View license
[Test]
        public void CanSample()
        {
            var d = new Zipf(0.7, 5);
            var s = d.Sample();
            Assert.LessOrEqual(s, 5);
            Assert.GreaterOrEqual(s, 0);
        }

28. Example

Project: Potato
Source File: TestPotatoPing.cs
View license
[Test]
        public void TestResultSuccessUptimeReturned() {
            PotatoController instance = new PotatoController() {
                InstantiatedStamp = DateTime.Now.AddSeconds(-5)
            };

            ICommandResult result = instance.Tunnel(CommandBuilder.PotatoPing().SetOrigin(CommandOrigin.Local));

            Assert.GreaterOrEqual(int.Parse(result.Now.Content.First()), 5000);

            instance.Dispose();
        }

29. Example

Project: NsqSharp
Source File: ChanTest.cs
View license
[Test]
        public void MultiThreadedSelectTestWithoutDefer()
        {
            var c1 = new /n ..... /n //View Source file for more details /n }

30. Example

Project: NsqSharp
Source File: ChanTest.cs
View license
[Test]
        public void MultiThreadedSelectTestWithDefer()
        {
            var c1 = new Cha/n ..... /n //View Source file for more details /n }

31. Example

Project: nunit
Source File: GreaterEqualFixture.cs
View license
[Test]
        public void FailureMessage()
        {
            var ex = Assert.Throws<AssertionException>(() => Assert.GreaterOrEqual(7, 99));

            var msg = ex.Message;

            StringAssert.Contains( TextMessageWriter.Pfx_Expected + "greater than or equal to 99", msg);
            StringAssert.Contains( TextMessageWriter.Pfx_Actual + "7", msg);
        }

32. Example

Project: Hopefully
Source File: ProcedureTest.cs
View license
[Test]
        public void TestFailedProcedureWithTimeInBetween()
        {
            var proc = new UnreliableProcedure(10);
            int failedAttempts = -1;
            int milliSecondsToWait = 50;
            var startTime = DateTime.Now;
            Assert.Throws(typeof (Exception), () =>
            {
                Procedure.Retry(() => proc.DoWork(), out failedAttempts, attempts: 5, wait: new TimeSpan(0, 0, 0, 0, milliSecondsToWait));
            });
            var endTime = DateTime.Now;
            var elapsedTime = endTime - startTime;
            Assert.GreaterOrEqual(elapsedTime.Milliseconds, milliSecondsToWait * (failedAttempts -1));
        }

33. Example

Project: Tigwi
Source File: MessageTest.cs
View license
[Test]
        //Big test on numbers
        public void GetListsMsgToNormalBehaviourOnBigNumbers()
        {
            int k;
            for (k = 0; k < 600; k++)
            {
                storage.Msg.Post(_accountId, Hw);
            }
            _date = DateTime.Now;

            var lists = new HashSet<Guid> { storage.List.GetPersonalList(_accountId) };
            var messages = storage.Msg.GetListsMsgTo(lists, _date, 333);
            Assert.AreEqual(messages.Count(), 333);
            foreach (var message in messages)
            {
                Assert.GreaterOrEqual(_date.CompareTo(message.Date), 0);
            }
        }

34. Example

Project: FieldWorks
Source File: EthnologueTests.cs
View license
[Test]
		public void TestGetLanguagesInCountry()
		{
			Ethnologue eth = new Ethnologue();
			List<Ethnologue.Names> res = eth.GetLanguagesInCountry("United States", true);
			Assert.GreaterOrEqual(res.Count, 200);
			Assert.LessOrEqual(res.Count, 250);
			Assert.AreEqual("aaq", res[0].EthnologueCode);

			List<Ethnologue.Names> res2 = eth.GetLanguagesInCountry("United States", false);
			Assert.GreaterOrEqual(res2.Count, 1000);
			Assert.AreEqual("eng", res2[0].EthnologueCode);
			Assert.AreEqual("AAVE", res2[0].LangName);
		}

35. Example

Project: FieldWorks
Source File: EthnologueTests.cs
View license
[Test]
		public void TestGetLanguagesForIso()
		{
			Ethnologue eth = new Ethnologue();
			List<Ethnologue.Names> res = eth.GetLanguagesForIso("eng");
			Assert.GreaterOrEqual(res.Count, 150);
			Assert.AreEqual("AAVE", res[0].LangName);
			Assert.AreEqual("US", res[0].CountryId);
			Assert.AreEqual("United States", res[0].CountryName);

			List<Ethnologue.Names> res2 = eth.GetLanguagesForIso("aaa");
			Assert.AreEqual(1, res2.Count);
			Assert.AreEqual("Ghotuo", res2[0].LangName);
			Assert.AreEqual("NG", res2[0].CountryId);
			Assert.AreEqual("Nigeria", res2[0].CountryName);
		}

36. Example

View license
[Test]
        public void TestDecorateClass()
        {
            var codeType = new CodeTypeDeclaration("TestClass");
            var decorator = new StandardConstructServiceDecorator();
            var service = CreateBuzzService();

            Assert.AreEqual(0, codeType.Members.Count);
            decorator.DecorateClass(service, codeType);

            Assert.AreEqual(1, codeType.Members.Count); // We expect one member to be added
            Assert.IsInstanceOf(typeof(CodeConstructor), codeType.Members[0]);
            var constructor = (CodeConstructor) codeType.Members[0];
            // Test that both of the add statment methods where called.
            Assert.GreaterOrEqual(constructor.Statements.Count, 9);

            //We have already tested the statment formation in the other tests.
        }

37. Example

Project: FieldWorks
Source File: EthnologueTests.cs
View license
[Test]
		public void TestGetLanguageNamesLike()
		{
			Ethnologue eth = new Ethnologue();
			List<Ethnologue.Names> res = eth.GetLanguageNamesLike("Amha", 'x');
			Assert.GreaterOrEqual(res.Count, 8);
			Assert.AreEqual("Amharic", res[0].LangName);
			Assert.AreEqual("amh", res[0].EthnologueCode);

			List<Ethnologue.Names> res2 = eth.GetLanguageNamesLike("Amha", 'L');
			Assert.Less(res2.Count, res.Count);
			Assert.AreEqual("Amharic", res2[res2.Count - 1].LangName);
			Assert.AreEqual("amh", res2[res2.Count - 1].EthnologueCode);

			List<Ethnologue.Names> res3 = eth.GetLanguageNamesLike("Amha", 'R');
			Assert.AreEqual(res.Count, res3.Count);		// Not what I like, but SQL code did this.

			List<Ethnologue.Names> res4 = eth.GetLanguageNamesLike("chao", 'R');
			Assert.GreaterOrEqual(res4.Count, 1);
			Assert.AreEqual(res4[0].LangName, "Biao Chao");
			Assert.AreEqual(res4[0].EthnologueCode, "bje");
		}

38. Example

View license
[Test]
        public void QueryingByIntIndexReturnsAListOfKeys()
        {
            GenerateGuidKeyObjects("QueryByIntIndex", (o, i) => o.IntIndex("age").Set(32, 20));

            var mr = new RiakMapReduceQuery()
                .Inputs(RiakIndex.Match(new RiakIndexId(LegacyBucket, "age"), 32));

            var result = Client.MapReduce(mr);
            Assert.IsTrue(result.IsSuccess, result.ErrorMessage);

            var keys = result.Value.PhaseResults.SelectMany(x => x.GetObjectIds()).ToList();
            Assert.GreaterOrEqual(keys.Count(), DefaultKeyCount);

            foreach (var key in keys)
            {
                Assert.True(EnumerableUtil.NotNullOrEmpty(key.Bucket));
                Assert.True(EnumerableUtil.NotNullOrEmpty(key.Key));
            }
        }

39. Example

View license
[Test]
        public void StreamingIndexGetReturnsAllData()
        {
            for (var i = 0; i < DefaultKeyCount; i++)
            {
                var o = CreateIntKeyedRiakObject("StreamingIndex", true, i);
                o.IntIndex("position").Set(i % 2);
                Client.Put(o, new RiakPutOptions().SetW(Quorum.WellKnown.All)
                    .SetDw(Quorum.WellKnown.All));
            }

            var results = Client.StreamGetSecondaryIndex(new RiakIndexId(Bucket, "position"), 0);

            Assert.IsTrue(results.IsSuccess, results.ErrorMessage);
            CollectionAssert.IsNotEmpty(results.Value.IndexKeyTerms);
            Assert.GreaterOrEqual(results.Value.IndexKeyTerms.Count(), 5);
        }

40. Example

Project: nunit
Source File: GreaterEqualFixture.cs
View license
[Test]
        public void NotGreaterOrEqual()
        {
            var expectedMessage =
                "  Expected: greater than or equal to 5" + Environment.NewLine +
                "  But was:  4" + Environment.NewLine;
            var ex = Assert.Throws<AssertionException>(() => Assert.GreaterOrEqual(i2, i1));
            Assert.That(ex.Message, Is.EqualTo(expectedMessage));
        }

41. Example

View license
[Test]
        public void TestCreateConstructorWithArgs()
        {
            var decorator = new StandardConstructServiceDecorator();
            CodeConstructor constructor = decorator.CreateConstructorWithArgs();

            Assert.AreEqual(2, constructor.Parameters.Count);
            Assert.AreEqual(typeof(IService).FullName, constructor.Parameters[0].Type.BaseType);
            Assert.AreEqual(typeof(IAuthenticator).FullName, constructor.Parameters[1].Type.BaseType);
            Assert.AreEqual(ServiceClassGenerator.GenericServiceName, constructor.Parameters[0].Name);
            Assert.AreEqual(ServiceClassGenerator.AuthenticatorName, constructor.Parameters[1].Name);
            Assert.GreaterOrEqual(2, constructor.Statements.Count);

            Assert.IsInstanceOf(typeof(CodeAssignStatement), constructor.Statements[0]);
            Assert.IsInstanceOf(typeof(CodeAssignStatement), constructor.Statements[1]);
        }

42. Example

View license
[Test]
        public void Load_StubClassConfigured_ReturnsStubClassAndProperties()
        {
            //Assign
            var loader = new OnDemandLoader<SitecoreTypeConfiguration>(typeof(StubClass));

            //Act
            var results = loader.Load();
            
            //Assert
            Assert.GreaterOrEqual(results.Count(), 0);

            var typeConfig = results.First(x => x.Type == typeof (StubClass));
            Assert.IsNotNull(typeConfig);

            var propertyNames = new[] {"Children", "Field", "Id", "Info", "Linked", "Node", "Parent", "Query"};

            foreach(var propertyName in propertyNames)
            {
                var propInfo = typeof (StubClass).GetProperty(propertyName);
                Assert.IsTrue(typeConfig.Properties.Any(x=>x.PropertyInfo == propInfo));
            }

        }

43. Example

View license
[Test]
        public void CanReadFudao007AsDouble()
        {
            using (Stream stream = TestData.Data.ReadStream("MatrixMarket.fidap007.mtx"))
            {
                var m = MatrixMarketReader.ReadMatrix<double>(stream);
                Assert.IsInstanceOf<LinearAlgebra.Double.SparseMatrix>(m);
                Assert.AreEqual(1633, m.RowCount);
                Assert.AreEqual(1633, m.ColumnCount);
                Assert.GreaterOrEqual(54487, ((LinearAlgebra.Double.SparseMatrix)m).NonZerosCount);
                Assert.Less(46000, ((LinearAlgebra.Double.SparseMatrix)m).NonZerosCount);
                Assert.AreEqual(-6.8596032449032e+06d, m[1604, 1631]);
                Assert.AreEqual(-9.1914585107976e+06d, m[1616, 1628]);
                Assert.AreEqual(7.9403870156486e+07d, m[905, 726]);
            }
        }

44. Example

View license
[Then(@"I should see at least ([\d,]+) results")]
        public void ThenIShouldSeeAtLeastNumberOfResults(string expMinNumberResults)
        {
            expMinNumberResults = expMinNumberResults.Replace(",", "");
            Assert.GreaterOrEqual(Convert.ToInt32(GoogleSearchResultsPage.NumberOfResults), Convert.ToInt32(expMinNumberResults));
        }

45. Example

View license
[Test]
        public void CanReadFudao007AsComplex()
        {
            using (TextReader reader = TestData.Data.ReadText("MatrixMarket.fidap007.mtx"))
            {
                var m = MatrixMarketReader.ReadMatrix<Complex>(reader);
                Assert.IsInstanceOf<LinearAlgebra.Complex.SparseMatrix>(m);
                Assert.AreEqual(1633, m.RowCount);
                Assert.AreEqual(1633, m.ColumnCount);
                Assert.GreaterOrEqual(54487, ((LinearAlgebra.Complex.SparseMatrix)m).NonZerosCount);
                Assert.Less(46000, ((LinearAlgebra.Complex.SparseMatrix)m).NonZerosCount);
                Assert.AreEqual(-6.8596032449032e+06d, m[1604, 1631].Real);
                Assert.AreEqual(0.0d, m[1604, 1631].Imaginary);
                Assert.AreEqual(-9.1914585107976e+06d, m[1616, 1628].Real);
                Assert.AreEqual(0.0d, m[1616, 1628].Imaginary);
                Assert.AreEqual(7.9403870156486e+07d, m[905, 726].Real);
                Assert.AreEqual(0.0d, m[905, 726].Imaginary);
            }
        }

46. Example

View license
[Test]
        public void CanReadFudao007AsComplex32()
        {
            using (TextReader reader = TestData.Data.ReadText("MatrixMarket.fidap007.mtx"))
            {
                var m = MatrixMarketReader.ReadMatrix<Complex32>(reader);
                Assert.IsInstanceOf<LinearAlgebra.Complex32.SparseMatrix>(m);
                Assert.AreEqual(1633, m.RowCount);
                Assert.AreEqual(1633, m.ColumnCount);
                Assert.GreaterOrEqual(54487, ((LinearAlgebra.Complex32.SparseMatrix)m).NonZerosCount);
                Assert.Less(46000, ((LinearAlgebra.Complex32.SparseMatrix)m).NonZerosCount);
                Assert.AreEqual(-6.8596032449032e+06f, m[1604, 1631].Real);
                Assert.AreEqual(0.0f, m[1604, 1631].Imaginary);
                Assert.AreEqual(-9.1914585107976e+06f, m[1616, 1628].Real);
                Assert.AreEqual(0.0f, m[1616, 1628].Imaginary);
                Assert.AreEqual(7.9403870156486e+07f, m[905, 726].Real);
                Assert.AreEqual(0.0f, m[905, 726].Imaginary);
            }
        }

47. Example

View license
[Test]
        public void CanReadFudao007AsSingle()
        {
            using (Stream stream = TestData.Data.ReadStream("MatrixMarket.fidap007.mtx"))
            {
                var m = MatrixMarketReader.ReadMatrix<float>(stream);
                Assert.IsInstanceOf<LinearAlgebra.Single.SparseMatrix>(m);
                Assert.AreEqual(1633, m.RowCount);
                Assert.AreEqual(1633, m.ColumnCount);
                Assert.GreaterOrEqual(54487, ((LinearAlgebra.Single.SparseMatrix)m).NonZerosCount);
                Assert.Less(46000, ((LinearAlgebra.Single.SparseMatrix)m).NonZerosCount);
                Assert.AreEqual(-6.8596032449032e+06f, m[1604, 1631]);
                Assert.AreEqual(-9.1914585107976e+06f, m[1616, 1628]);
                Assert.AreEqual(7.9403870156486e+07f, m[905, 726]);
            }
        }

48. Example

View license
[Test]
        public void LatchedRecurring()
        {
            var runCount = 0;
            var waitHandle = new ManualResetEvent(false);
            using (var runner = new BackgroundTaskRunner<IBackgroundTask>(new BackgroundTaskRunnerOptions(), _logger))
            {
                runner.TaskCompleted += (sender, args) =>
                {
                    runCount++;
                    if (runCount > 3)
                        waitHandle.Set();

                };

                var task = new MyDelayedRecurringTask(runner, 2000, 1000);
                runner.Add(task);
                Assert.IsTrue(runner.IsRunning); // waiting on delay
                Assert.AreEqual(0, runCount);

                waitHandle.WaitOne();
                Assert.GreaterOrEqual(runCount, 4);
                Assert.IsTrue(task.HasRun);

                // stops recurring
                runner.Shutdown(false, false);
            }
        }

49. Example

View license
[Test]
        public void RecurringTaskTest()
        {
            var runCount = 0;
            var waitHandle = new ManualResetEvent(false);
            using (var runner = new BackgroundTaskRunner<IBackgroundTask>(new BackgroundTaskRunnerOptions(), _logger))
            {
                runner.TaskCompleted += (sender, args) =>
                {
                    runCount++;
                    if (runCount > 3)
                        waitHandle.Set();
                };

                var task = new MyRecurringTask(runner, 200, 500);

                runner.Add(task);

                Assert.IsTrue(runner.IsRunning); // waiting on delay
                Assert.AreEqual(0, runCount);

                waitHandle.WaitOne();

                Assert.GreaterOrEqual(runCount, 4);

                // stops recurring
                runner.Shutdown(false, true);

                // check that task has been disposed (timer has been killed, etc)
                Assert.IsTrue(task.IsDisposed);
            }
        }

50. Example

View license
[Test]
        public void IntIndexGetReturnsListOfKeys()
        {
            GenerateIntKeyObjects("IntIndex", (o, i) => o.IntIndex("age").Add(32));

            var idxid = new RiakIndexId(LegacyBucket, "age");
            var result = Client.GetSecondaryIndex(idxid, 32);
            Assert.IsTrue(result.IsSuccess, result.ErrorMessage);
            CollectionAssert.IsNotEmpty(result.Value.IndexKeyTerms);
            Assert.GreaterOrEqual(result.Value.IndexKeyTerms.Count(), DefaultKeyCount);

            foreach (var v in result.Value.IndexKeyTerms)
            {
                var key = ParseIntKeyWithPrefix(v);
                key.ShouldBeLessThan(DefaultKeyCount);
                key.ShouldBeGreaterThan(-1);
            }
        }