NUnit.Framework.Assert.AreNotEqual(int, int, string)

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

29 Examples 7

1. Example

View license
[Test]
		public void NHibernate_should_be_cls_compliant()
		{
			CLSCompliantAttribute[] attributes = (CLSCompliantAttribute[])typeof(ISession).Assembly.GetCustomAttributes(typeof(CLSCompliantAttribute), true);
			Assert.AreNotEqual(0, attributes.Length, "NHibernate should specify CLS Compliant attribute");
			Assert.IsTrue(attributes[0].IsCompliant, "NHibernate should be CLS Compliant");
		}

2. Example

Project: DreamNJasmine
Source File: NUnitFixtureResult.cs
View license
public IFixtureResult failed()
        {
            Assert.AreNotEqual(0, GetErrorCount() + GetFailureCount(), _testName + " didn't have errors.");

            return this;
        }

3. Example

View license
[Test]
    public void TestDifferent ()
    {

      const string StartUrl = "https://nazuke.github./n ..... /n //View Source file for more details /n }

4. Example

Project: nant
Source File: RegexTaskTest.cs
View license
[Test]
        public void Test_RegexMatchMultiple() {
            string _xml = @"
                    <project name='RegexTests'>
                        <regex pattern=""^(?'path'.*(\\|/)|(/|\\))(?'file'.*)$"" input=""d:\Temp\SomeDir\SomeDir\bla.xml"" />
                        <echo message='path=${path}'/>
                        <echo message='file=${file}'/>
                    </project>";
            string result = RunBuild(_xml);
            Assert.AreNotEqual(-1, result.IndexOf(@"path=d:\Temp\SomeDir\SomeDir\"),
                String.Concat("Regex did not set first property correcty.\n", result));
            Assert.AreNotEqual(-1, result.IndexOf(@"file=bla.xml"),
                String.Concat("Regex did not set second property correcty.\n", result));
        }

5. Example

Project: nant
Source File: RegexTaskTest.cs
View license
[Test]
        public void Test_RegexMatch() {
            string _xml = @"
                    <project name='RegexTests'>
                        <regex pattern=""(?'lastword'\w+)$"" input='This is a test sentence' />
                        <echo message='${lastword}'/>
                    </project>";
            string result = RunBuild(_xml);
            Assert.AreNotEqual(-1, result.IndexOf("sentence"),
                String.Concat("Regex did not match properly.\n", result));
        }

6. Example

Project: sqlite-net
Source File: ByteArrayTest.cs
View license
[Test]
        [Description("Uses a null byte array to find a record")]
        public void ByteArra/n ..... /n //View Source file for more details /n }

7. Example

View license
[Test]
        public void ResetMaximumIterations()
        {
            var criterion = new IterationCountStopCriterion<double>(10);
            Assert.IsNotNull(criterion, "A criterion should have been created");
            Assert.AreEqual(10, criterion.MaximumNumberOfIterations, "Incorrect maximum number of iterations");

            criterion.ResetMaximumNumberOfIterationsToDefault();
            Assert.AreNotEqual(10, criterion.MaximumNumberOfIterations, "Should have reset");
            Assert.AreEqual(IterationCountStopCriterion<double>.DefaultMaximumNumberOfIterations, criterion.MaximumNumberOfIterations, "Reset to the wrong value");
        }

8. Example

View license
[Test]
        public void ResetMaximumIterations()
        {
            var criterion = new IterationCountStopCriterion<Complex>(10);
            Assert.IsNotNull(criterion, "A criterion should have been created");
            Assert.AreEqual(10, criterion.MaximumNumberOfIterations, "Incorrect maximum number of iterations");

            criterion.ResetMaximumNumberOfIterationsToDefault();
            Assert.AreNotEqual(10, criterion.MaximumNumberOfIterations, "Should have reset");
            Assert.AreEqual(IterationCountStopCriterion<Complex>.DefaultMaximumNumberOfIterations, criterion.MaximumNumberOfIterations, "Reset to the wrong value");
        }

9. Example

View license
[Test]
        public void ResetMaximumIterations()
        {
            var criterion = new IterationCountStopCriterion<Complex32>(10);
            Assert.IsNotNull(criterion, "A criterion should have been created");
            Assert.AreEqual(10, criterion.MaximumNumberOfIterations, "Incorrect maximum number of iterations");

            criterion.ResetMaximumNumberOfIterationsToDefault();
            Assert.AreNotEqual(10, criterion.MaximumNumberOfIterations, "Should have reset");
            Assert.AreEqual(IterationCountStopCriterion<Complex32>.DefaultMaximumNumberOfIterations, criterion.MaximumNumberOfIterations, "Reset to the wrong value");
        }

10. Example

View license
[Test]
        public void ResetMaximumIterations()
        {
            var criterion = new IterationCountStopCriterion<float>(10);
            Assert.IsNotNull(criterion, "A criterion should have been created");
            Assert.AreEqual(10, criterion.MaximumNumberOfIterations, "Incorrect maximum number of iterations");

            criterion.ResetMaximumNumberOfIterationsToDefault();
            Assert.AreNotEqual(10, criterion.MaximumNumberOfIterations, "Should have reset");
            Assert.AreEqual(IterationCountStopCriterion<float>.DefaultMaximumNumberOfIterations, criterion.MaximumNumberOfIterations, "Reset to the wrong value");
        }

11. Example

Project: sqlite-net
Source File: ByteArrayTest.cs
View license
[Test]
        [Description("Uses a byte array to find a record")]
        public void ByteArrayWher/n ..... /n //View Source file for more details /n }

12. Example

View license
[Test]
        public void TestUnPausePriority()
        {
            InitializeTestValues();
            var queue = new TickedQueue();
            var a = new TickedObject(CallbackSetTest1, 0, 0) {Priority = 0};
            var b = new TickedObject(CallbackSetTest1, 0, 2) {Priority = 2};
            var c = new TickedObject(CallbackSetTest1, 0, 1) {Priority = 1};

            queue.Add(a);
            queue.Add(b);
            queue.Add(c);

            Assert.AreEqual(-1, test1, "test1 should be initialized with -1");
            queue.IsPaused = true;
            queue.Update(DateTime.UtcNow.AddSeconds(2));
            Assert.AreEqual(-1, test1, "test1 should be still be -1, since we are paused");

            queue.IsPaused = false;
            queue.Update(DateTime.UtcNow.AddSeconds(2));
            Assert.AreNotEqual(-1, test1, "test1 should have changed after all three items ticked");
            Assert.AreEqual(2, test1, "test1 should have been updated to the last object");
        }

13. Example

View license
[Test]
        public void TestPriority()
        {
            InitializeTestValues();
            var queue = new TickedQueue();
            var a = new TickedObject(CallbackSetTest1, 0, 0) {Priority = 0};
            var b = new TickedObject(CallbackSetTest1, 0, 2) {Priority = 2};
            var c = new TickedObject(CallbackSetTest1, 0, 1) {Priority = 1};

            queue.Add(a);
            queue.Add(b);
            queue.Add(c);

            Assert.AreEqual(-1, test1, "test1 should be initialized with -1");
            queue.Update();
            Assert.AreEqual(-1, test1,
                "test1 should still be same after first update, as none of the objects should have ticked");
            queue.Update(DateTime.UtcNow.AddSeconds(2));
            Assert.AreNotEqual(-1, test1, "test1 should have changed after all three items ticked");
            Assert.AreEqual(2, test1, "test1 should have been updated to the last object");
        }

14. Example

View license
public void Verify( object returnTypeForMethod )
        {
            Type returnType = returnTypeForMethod as Type;
            MethodInfo[] methods = typeTovalidate.GetMethods();
            
            Assert.AreNotEqual(0, methods.Length, "No methods found returning " + returnType );

            int staticMethodCount = 0;
            foreach (MethodInfo methodInfo in methods)
            {
                if (methodInfo.ReturnType == returnType && methodInfo.IsStatic)
                {
                    Assert.IsNotNull(methodInfo.Invoke(null, null), "Null value returned for " + methodInfo.Name);
                    staticMethodCount++;
                }
            }

            Assert.AreNotEqual(0, staticMethodCount, "Static method call count should not be zero");
        }

15. Example

Project: DreamNJasmine
Source File: NUnitFixtureResult.cs
View license
public IFixtureResult succeeds()
        {
            int totalCount = (int)_doc.Root.Attribute("total");
            int errorCount = GetErrorCount();
            int failureCount = GetFailureCount();

            Assert.AreEqual(0, errorCount, _testName + " had errors.");
            Assert.AreEqual(0, failureCount, _testName + " had failures.");
            Assert.AreNotEqual(0, totalCount, _testName + " didn't have any tests.");

            return this;
        }

16. Example

Project: sqlite-net
Source File: NotNullAttributeTest.cs
View license
[Test]
		public void CreateTableWithNotNullConstraints ()
		{
			using (var db = new TestDb ()) {
				db.CreateTable<NotNullNoPK> ();
				var cols = db.GetTableInfo ("NotNullNoPK");

				var joined = from expected in GetExpectedColumnInfos (typeof (NotNullNoPK))
							 join actual in cols on expected.Name equals actual.Name
							 where actual.notnull != expected.notnull
							 select actual.Name;

				Assert.AreNotEqual (0, cols.Count (), "Failed to get table info");
				Assert.IsTrue (joined.Count () == 0, string.Format ("not null constraint was not created for the following properties: {0}"
					, string.Join (", ", joined.ToArray ())));
			}
		}

17. Example

Project: sqlite-net
Source File: NotNullAttributeTest.cs
View license
[Test]
		public void PrimaryKeyHasNotNullConstraint ()
		{
			using (TestDb db = new TestDb ()) {

				db.CreateTable<ClassWithPK> ();
				var cols = db.GetTableInfo ("ClassWithPK");

				var joined = from expected in GetExpectedColumnInfos (typeof (ClassWithPK))
							 join actual in cols on expected.Name equals actual.Name
							 where actual.notnull != expected.notnull
							 select actual.Name;

				Assert.AreNotEqual (0, cols.Count (), "Failed to get table info");
				Assert.IsTrue (joined.Count () == 0, string.Format ("not null constraint was not created for the following properties: {0}"
					, string.Join (", ", joined.ToArray ())));
			}
		}

18. Example

Project: Plankton
Source File: HalfedgeTest.cs
View license
[Test]
        public void CanFlipEdge()
        {
            // Create a triangulated grid and fli/n ..... /n //View Source file for more details /n }

19. Example

Project: imt-wanke-client
Source File: NetworkIOTests.cs
View license
public void DoSend (bool slowOutgoing, bool slowIncoming)
        {
            Incoming.SlowConnection = slowIncoming;
            Outgoing.SlowConnection = slowOutgoing;

            var handle = new ManualResetEvent (false);
            NetworkIO.EnqueueSend (Outgoing, data, 0, data.Length, null, null, null, delegate {
                handle.Set ();
            }, null);

            int received = 0;
            byte[] buffer = new byte [data.Length];
            while (received != buffer.Length) {
                int r = Incoming.Receive (buffer, received, buffer.Length - received);
                Assert.AreNotEqual (0, r, "#Received data");
                received += r;
            }
            Assert.IsTrue (handle.WaitOne (TimeSpan.FromSeconds (1)), "Data should be all sent");
            Assert.IsTrue (Toolbox.ByteMatch (buffer, data), "Data matches");
        }

20. Example

Project: memcache-driver
Source File: LocatorTests.cs
View license
[Test]
        public void KetamaDeadNodeDetectionTest2()
        {
            var locator = new KetamaLocator();
            locator.Initialize(_nodes);

            for (int i = 0; i < _nodes.Count; ++i)
            {
                foreach (IMemcacheNode node in _nodes)
                    (node as NodeMock).IsDead = false;

                var keyAsBytes = i.ToString().Select(c => (byte)c).ToArray();
                var locations = locator.Locate(new RequestKeyWrapper(keyAsBytes));

                var j = 0;
                var nodesSet = new HashSet<IMemcacheNode>();
                foreach (var chosenNode in locations)
                {
                    nodesSet.Add(chosenNode);
                    Assert.IsFalse(chosenNode.IsDead, "KetamaLocator returned a dead node");
                    // Kill one of the nodes
                    (_nodes[j++] as NodeMock).IsDead = true;
                }

                Assert.AreNotEqual(0, nodesSet.Count, "KetamaLocator returned no node");
            }

            foreach (var node in _nodes)
                (node as NodeMock).IsDead = false;
        }

21. Example

Project: FieldWorks
Source File: ExportDialogTests.cs
View license
[Test]
		public void ExportTranslatedLists2()
		{
			Assert.AreEqual(2, m_cache.LangProject.Semantic/n ..... /n //View Source file for more details /n }

22. Example

Project: imt-wanke-client
Source File: NetworkIOTests.cs
View license
void DoReceive (bool slowOutgoing, bool slowIncoming)
        {
            Incoming.SlowConnection = slowIncoming;
            Outgoing.SlowConnection = slowOutgoing;

            int sent = 0;
            buffer = new byte [data.Length];

            var handle = new ManualResetEvent (false);
            NetworkIO.EnqueueReceive (Outgoing, buffer, 0, buffer.Length, null, null, null, (s, t, o) => {
                Assert.IsTrue (s, "#Receive successful");
                Assert.AreEqual (buffer.Length, t, "#data was all received");
                handle.Set ();
            }, null);

            while (sent != buffer.Length) {
                int r = Incoming.Send (data, sent, data.Length - sent);
                Assert.AreNotEqual (0, r, "#Received data");
                sent += r;
            }

            Assert.IsTrue (handle.WaitOne (TimeSpan.FromSeconds (4)), "Data should be all received");
            for (int i = 0; i < buffer.Length; i++) {
                if (data[i] != buffer[i])
                    Assert.Fail ("Buffers differ at position " + i);
            }
        }

23. Example

Project: FieldWorks
Source File: ExportDialogTests.cs
View license
[Test]
		public void ExportTranslatedLists()
		{
			Assert.AreEqual(2, m_cache.LangProject.SemanticD/n ..... /n //View Source file for more details /n }

24. Example

Project: BloomDesktop
Source File: BookCompressorTests.cs
View license
[Test]
		public void CompressBookForDevice_IncludesWantedFiles()
		{
			var wantedFiles = new List<string>()
			{
				"thumbnail.png", // should be left alone
				"previewMode.css",
				"meta.json", // should be left alone
				"readerStyles.css", // gets added
				"Device-XMatter.css" // added when we apply this xmatter
			};

			TestHtmlAfterCompression(kMinimumValidBookHtml,
				actionsOnFolderBeforeCompressing: folderPath =>
				{
					// These png files have to be real; just putting some text in it leads to out-of-memory failures when Bloom
					// tries to make its background transparent.
					File.Copy(SIL.IO.FileLocator.GetFileDistributedWithApplication(_pathToTestImages, "shirt.png"),
						Path.Combine(folderPath, "thumbnail.png"));
					File.WriteAllText(Path.Combine(folderPath, "previewMode.css"), @"This is wanted");
				},
				assertionsOnZipArchive: zip =>
				{
					foreach (var name in wantedFiles)
					{
						Assert.AreNotEqual(-1, zip.FindEntry(Path.GetFileName(name), true), "expected " + name + " to be part of .bloomd zip");
					}
				});
		}

25. Example

View license
[Test]
		public void PartialComponentGeneration()
		{
			ComponentOwner owner = new ComponentOwner("initial");
			ISession s = OpenSession();
			s.BeginTransaction();
			s.Save(owner);
			s.Transaction.Commit();
			s.Close();

			Assert.IsNotNull(owner.Component, "expecting insert value generation");
			int previousValue = owner.Component.Generated;
			Assert.AreNotEqual(0, previousValue, "expecting insert value generation");

			s = OpenSession();
			s.BeginTransaction();
			owner = (ComponentOwner) s.Get(typeof(ComponentOwner), owner.Id);
			Assert.AreEqual(previousValue, owner.Component.Generated, "expecting insert value generation");
			owner.Name = "subsequent";
			s.Transaction.Commit();
			s.Close();

			Assert.IsNotNull(owner.Component);
			previousValue = owner.Component.Generated;

			s = OpenSession();
			s.BeginTransaction();
			owner = (ComponentOwner) s.Get(typeof(ComponentOwner), owner.Id);
			Assert.AreEqual(previousValue, owner.Component.Generated, "expecting update value generation");
			s.Delete(owner);
			s.Transaction.Commit();
			s.Close();
		}

26. Example

View license
[Test]
		public async Task PartialComponentGenerationAsync()
		{
			ComponentOwner owner = new ComponentOwner("initial");
			ISession s = OpenSession();
			s.BeginTransaction();
			await (s.SaveAsync(owner));
			await (s.Transaction.CommitAsync());
			s.Close();

			Assert.IsNotNull(owner.Component, "expecting insert value generation");
			int previousValue = owner.Component.Generated;
			Assert.AreNotEqual(0, previousValue, "expecting insert value generation");

			s = OpenSession();
			s.BeginTransaction();
			owner = (ComponentOwner) await (s.GetAsync(typeof(ComponentOwner), owner.Id));
			Assert.AreEqual(previousValue, owner.Component.Generated, "expecting insert value generation");
			owner.Name = "subsequent";
			await (s.Transaction.CommitAsync());
			s.Close();

			Assert.IsNotNull(owner.Component);
			previousValue = owner.Component.Generated;

			s = OpenSession();
			s.BeginTransaction();
			owner = (ComponentOwner) await (s.GetAsync(typeof(ComponentOwner), owner.Id));
			Assert.AreEqual(previousValue, owner.Component.Generated, "expecting update value generation");
			await (s.DeleteAsync(owner));
			await (s.Transaction.CommitAsync());
			s.Close();
		}

27. Example

Project: Unity
Source File: Tests.cs
View license
[Test]
        public async void ChainingOnDifferentSchedulers()
        {
            var output = /n ..... /n //View Source file for more details /n }

28. Example

View license
[Test]
        public void should_stop_properly_while_running()
        {
            // Arrange
            const int repeat = 1000;
            const int delay = 100;
            const string outputLine = "Line #";
            const bool unstoppable = false;

            var app = GetDummyApp(outputLine, repeat, delay, unstoppable);
            var actual = new List<string>();
            app.ConsoleOutput += (sender, args) => actual.Add(args.Line);

            // Act
            app.Run();
            Thread.Sleep(500);
            app.Stop(ConsoleSpecialKey.ControlC, 500);
            var exited = app.WaitForExit(10000);

            // Assert
            Assert.IsTrue(exited, "App hasn't exited within allowed timeout");
            Assert.AreEqual(-1, app.ExitCode, "App should have been terminated by CTRL-C");
            Assert.IsTrue(actual.Any(), "No output captured");
            Assert.AreNotEqual(repeat, actual.Count(), "App hasn't been stopped");
        }

29. Example

View license
[Test]
        public void should_abort_if_nonstoppable()
        {
            // Arrange
            const int repeat = 1000;
            const int delay = 100;
            const string outputLine = "Line #";
            const bool unstoppable = true;

            var app = GetDummyApp(outputLine, repeat, delay, unstoppable);
            var actual = new List<string>();
            app.ConsoleOutput += (sender, args) => actual.Add(args.Line);

            // Act
            app.Run();
            Thread.Sleep(500);
            app.Stop(ConsoleSpecialKey.ControlC, 500);
            var exited = app.WaitForExit(10000);

            // Assert
            Assert.IsTrue(exited, "App hasn't exited within allowed timeout");
            Assert.AreEqual(-1, app.ExitCode, "App should have been terminated forcefully");
            Assert.IsTrue(actual.Any(), "No output captured");
            Assert.AreNotEqual(repeat, actual.Count(), "App hasn't been stopped");
        }