NUnit.Framework.Assert.AreEqual(long, long, string)

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

120 Examples 7

1. Example

Project: NPOI
Source File: TestLongField.cs
View license
[Test]
        public void TestWriteToBytes()
        {
            LongField field = new LongField(0);
            byte[]    array = new byte[ 8 ];

            for (int j = 0; j < _test_array.Length; j++)
            {
                field.Value=_test_array[ j ];
                field.WriteToBytes(array);
                long val = (( long ) array[ 7 ]) << 56;

                val &= unchecked((long)0xFF00000000000000L);
                val += ((( long ) array[ 6 ]) << 48) & 0x00FF000000000000L;
                val += ((( long ) array[ 5 ]) << 40) & 0x0000FF0000000000L;
                val += ((( long ) array[ 4 ]) << 32) & 0x000000FF00000000L;
                val += ((( long ) array[ 3 ]) << 24) & 0x00000000FF000000L;
                val += ((( long ) array[ 2 ]) << 16) & 0x0000000000FF0000L;
                val += ((( long ) array[ 1 ]) << 8) & 0x000000000000FF00L;
                val += (array[ 0 ] & 0x00000000000000FFL);
                Assert.AreEqual(_test_array[ j ], val,"testing ");
            }
        }

2. Example

Project: Bless
Source File: BaseConverterTests.cs
View license
[Test]
	public void BaseConverterTest2()
	{
		long l2 = BaseConverter.ConvertToNum("11110001101000", 2);
		long l8 = BaseConverter.ConvertToNum("36150", 8);
		long l10 = BaseConverter.ConvertToNum("15464", 10);
		long l16 = BaseConverter.ConvertToNum("3C68", 16);

		Assert.AreEqual(15464, l2, "#base2");
		Assert.AreEqual(15464, l8, "#base8");
		Assert.AreEqual(15464, l10, "#base10");
		Assert.AreEqual(15464, l16, "#base16");
	}

3. Example

Project: Bless
Source File: BaseConverterTests.cs
View license
[Test]
	public void BaseConverterTest5()
	{
		long l16 = BaseConverter.Parse("  0x66  ");
		long l10 = BaseConverter.Parse("  66  ");
		long l8 = BaseConverter.Parse("  066  ");

		Assert.AreEqual(0x66, l16, "#base16");
		Assert.AreEqual(66, l10, "#base10");
		Assert.AreEqual(54, l8, "#base8");
	}

4. Example

Project: nesper
Source File: TestInfraExecuteQuery.cs
View license
private void AssertCtxInfraCountPerCode(long[] expectedCountPerCode)
        {
            for (var i = 0; i < expectedCountPerCode.Length; i++) {
                Assert.AreEqual(expectedCountPerCode[i], GetCtxInfraCount(i), "for code " + i);
            }
        }

5. Example

Project: NsqSharp
Source File: TimeTest.cs
View license
[Test]
        public void TestParseDuration()
        {
            foreach (var kvp in _parseDurationTests)
            {
                string input = kvp.Key;
                bool shouldPass = kvp.Value.ShouldPass;
                long expected = kvp.Value.Expected;
                Type expectedException = kvp.Value.ExpectedException;

                if (shouldPass)
                {
                    long actual = Time.ParseDuration(input);
                    Assert.AreEqual(expected, actual, input);
                }
                else
                {
                    Assert.Throws(expectedException, () => Time.ParseDuration(input));
                }
            }

            Assert.Throws<ArgumentNullException>(() => Time.ParseDuration(null));
        }

6. Example

Project: mathnet-numerics
Source File: GcdRelatedTest.cs
View license
[Test]
        public void GcdHandlesNormalInputCorrectly()
        {
            Assert.AreEqual(0, Euclid.GreatestCommonDivisor(0, 0), "Gcd(0,0)");
            Assert.AreEqual(6, Euclid.GreatestCommonDivisor(0, 6), "Gcd(0,6)");
            Assert.AreEqual(1, Euclid.GreatestCommonDivisor(7, 13), "Gcd(7,13)");
            Assert.AreEqual(7, Euclid.GreatestCommonDivisor(7, 14), "Gcd(7,14)");
            Assert.AreEqual(1, Euclid.GreatestCommonDivisor(7, 15), "Gcd(7,15)");
            Assert.AreEqual(3, Euclid.GreatestCommonDivisor(6, 15), "Gcd(6,15)");
        }

7. Example

Project: mathnet-numerics
Source File: GcdRelatedTest.cs
View license
[Test]
        public void GcdHandlesNegativeInputCorrectly()
        {
            Assert.AreEqual(5, Euclid.GreatestCommonDivisor(-5, 0), "Gcd(-5,0)");
            Assert.AreEqual(5, Euclid.GreatestCommonDivisor(0, -5), "Gcd(0, -5)");
            Assert.AreEqual(1, Euclid.GreatestCommonDivisor(-7, 15), "Gcd(-7,15)");
            Assert.AreEqual(1, Euclid.GreatestCommonDivisor(-7, -15), "Gcd(-7,-15)");
        }

8. Example

Project: mathnet-numerics
Source File: GcdRelatedTest.cs
View license
[Test]
        public void GcdSupportsLargeInput()
        {
            Assert.AreEqual(Int32.MaxValue, Euclid.GreatestCommonDivisor(0, Int32.MaxValue), "Gcd(0,Int32Max)");
            Assert.AreEqual(Int64.MaxValue, Euclid.GreatestCommonDivisor(0, Int64.MaxValue), "Gcd(0,Int64Max)");
            Assert.AreEqual(1, Euclid.GreatestCommonDivisor(Int32.MaxValue, Int64.MaxValue), "Gcd(Int32Max,Int64Max)");
            Assert.AreEqual(1 << 18, Euclid.GreatestCommonDivisor(1 << 18, 1 << 20), "Gcd(1>>18,1<<20)");
        }

9. Example

Project: mathnet-numerics
Source File: GcdRelatedTest.cs
View license
[Test]
        public void ExtendedGcdHandlesNormalInputCorrectly()
        {
            long x, y;

            Assert.AreEqual(3, Euclid.ExtendedGreatestCommonDivisor(6, 15, out x, out y), "Egcd(6,15)");
            Assert.AreEqual(3, (6*x) + (15*y), "Egcd(6,15) -> a*x+b*y");

            Assert.AreEqual(3, Euclid.ExtendedGreatestCommonDivisor(-6, 15, out x, out y), "Egcd(-6,15)");
            Assert.AreEqual(3, (-6*x) + (15*y), "Egcd(-6,15) -> a*x+b*y");

            Assert.AreEqual(3, Euclid.ExtendedGreatestCommonDivisor(-6, -15, out x, out y), "Egcd(-6,-15)");
            Assert.AreEqual(3, (-6*x) + (-15*y), "Egcd(-6,-15) -> a*x+b*y");
        }

10. Example

Project: mathnet-numerics
Source File: GcdRelatedTest.cs
View license
[Test]
        public void ListGcdHandlesNormalInputCorrectly()
        {
            Assert.AreEqual(2, Euclid.GreatestCommonDivisor(-10, 6, -8), "Gcd(-10,6,-8)");
            Assert.AreEqual(1, Euclid.GreatestCommonDivisor(-10, 6, -8, 5, 9, 13), "Gcd(-10,6,-8,5,9,13)");
            Assert.AreEqual(5, Euclid.GreatestCommonDivisor(-10, 20, 120, 60, -15, 1000), "Gcd(-10,20,120,60,-15,1000)");
            Assert.AreEqual(3, Euclid.GreatestCommonDivisor(Int64.MaxValue - 1, Int64.MaxValue - 4, Int64.MaxValue - 7), "Gcd(Int64Max-1,Int64Max-4,Int64Max-7)");
            Assert.AreEqual(123, Euclid.GreatestCommonDivisor(492, -2*492, 492/4), "Gcd(492, -984, 123)");
        }

11. Example

Project: mathnet-numerics
Source File: GcdRelatedTest.cs
View license
[Test]
        public void ListGcdHandlesSpecialInputCorrectly()
        {
            Assert.AreEqual(0, Euclid.GreatestCommonDivisor(new long[0]), "Gcd()");
            Assert.AreEqual(100, Euclid.GreatestCommonDivisor(-100), "Gcd(-100)");
        }

12. Example

Project: mathnet-numerics
Source File: GcdRelatedTest.cs
View license
[Test]
        public void LcmHandlesNormalInputCorrectly()
        {
            Assert.AreEqual(10, Euclid.LeastCommonMultiple(10, 10), "Lcm(10,10)");

            Assert.AreEqual(0, Euclid.LeastCommonMultiple(0, 10), "Lcm(0,10)");
            Assert.AreEqual(0, Euclid.LeastCommonMultiple(10, 0), "Lcm(10,0)");

            Assert.AreEqual(77, Euclid.LeastCommonMultiple(11, 7), "Lcm(11,7)");
            Assert.AreEqual(33, Euclid.LeastCommonMultiple(11, 33), "Lcm(11,33)");
            Assert.AreEqual(374, Euclid.LeastCommonMultiple(11, 34), "Lcm(11,34)");
        }

13. Example

Project: mathnet-numerics
Source File: GcdRelatedTest.cs
View license
[Test]
        public void LcmHandlesNegativeInputCorrectly()
        {
            Assert.AreEqual(352, Euclid.LeastCommonMultiple(11, -32), "Lcm(11,-32)");
            Assert.AreEqual(352, Euclid.LeastCommonMultiple(-11, 32), "Lcm(-11,32)");
            Assert.AreEqual(352, Euclid.LeastCommonMultiple(-11, -32), "Lcm(-11,-32)");
        }

14. Example

Project: mathnet-numerics
Source File: GcdRelatedTest.cs
View license
[Test]
        public void LcmSupportsLargeInput()
        {
            Assert.AreEqual(Int32.MaxValue, Euclid.LeastCommonMultiple(Int32.MaxValue, Int32.MaxValue), "Lcm(Int32Max,Int32Max)");
            Assert.AreEqual(Int64.MaxValue, Euclid.LeastCommonMultiple(Int64.MaxValue, Int64.MaxValue), "Lcm(Int64Max,Int64Max)");
            Assert.AreEqual(Int64.MaxValue, Euclid.LeastCommonMultiple(-Int64.MaxValue, -Int64.MaxValue), "Lcm(-Int64Max,-Int64Max)");
            Assert.AreEqual(Int64.MaxValue, Euclid.LeastCommonMultiple(-Int64.MaxValue, Int64.MaxValue), "Lcm(-Int64Max,Int64Max)");
        }

15. Example

Project: mathnet-numerics
Source File: GcdRelatedTest.cs
View license
[Test]
        public void ListLcmHandlesNormalInputCorrectly()
        {
            Assert.AreEqual(120, Euclid.LeastCommonMultiple(-10, 6, -8), "Lcm(-10,6,-8)");
            Assert.AreEqual(4680, Euclid.LeastCommonMultiple(-10, 6, -8, 5, 9, 13), "Lcm(-10,6,-8,5,9,13)");
            Assert.AreEqual(3000, Euclid.LeastCommonMultiple(-10, 20, 120, 60, -15, 1000), "Lcm(-10,20,120,60,-15,1000)");
            Assert.AreEqual(984, Euclid.LeastCommonMultiple(492, -2*492, 492/4), "Lcm(492, -984, 123)");
            Assert.AreEqual(2016, Euclid.LeastCommonMultiple(32, 42, 36, 18), "Lcm(32,42,36,18)");
        }

16. Example

Project: mathnet-numerics
Source File: GcdRelatedTest.cs
View license
[Test]
        public void ListLcmHandlesSpecialInputCorrectly()
        {
            Assert.AreEqual(1, Euclid.LeastCommonMultiple(new long[0]), "Lcm()");
            Assert.AreEqual(100, Euclid.LeastCommonMultiple(-100), "Lcm(-100)");
        }

17. Example

View license
[Test]
        public void CeilingToPowerOfTwoReturnsZeroForNegativeNumbers64()
        {
            Assert.AreEqual(0, ((long)-1).CeilingToPowerOfTwo(), "-1");
            Assert.AreEqual(0, ((long)-2).CeilingToPowerOfTwo(), "-2");
            Assert.AreEqual(0, ((long)-3).CeilingToPowerOfTwo(), "-3");
            Assert.AreEqual(0, ((long)-4).CeilingToPowerOfTwo(), "-4");
            Assert.AreEqual(0, Int64.MinValue.CeilingToPowerOfTwo(), "Int64.MinValue");
            Assert.AreEqual(0, (Int64.MinValue + 1).CeilingToPowerOfTwo(), "Int64.MinValue+1");
        }

18. Example

View license
[Test]
        public void CeilingToPowerOfHandlesPositiveIntegersCorrectly64()
        {
            Assert.AreEqual(0, ((long)0).CeilingToPowerOfTwo(), "0");
            Assert.AreEqual(1, ((long)1).CeilingToPowerOfTwo(), "1");
            Assert.AreEqual(2, ((long)2).CeilingToPowerOfTwo(), "2");
            Assert.AreEqual(4, ((long)3).CeilingToPowerOfTwo(), "3");
            Assert.AreEqual(4, ((long)4).CeilingToPowerOfTwo(), "4");

            for (var i = 2; i < 63; i++)
            {
                var x = ((long)1) << i;
                Assert.AreEqual(x, x.CeilingToPowerOfTwo(), x.ToString(CultureInfo.InvariantCulture));
                Assert.AreEqual(x, (x - 1).CeilingToPowerOfTwo(), x + "-1");
                Assert.AreEqual(x, ((x >> 1) + 1).CeilingToPowerOfTwo(), x + "/2+1");
                Assert.AreEqual(0, (-x).CeilingToPowerOfTwo(), "-" + x);
            }

            const long MaxPowerOfTwo = 0x4000000000000000;
            Assert.AreEqual(MaxPowerOfTwo, MaxPowerOfTwo.CeilingToPowerOfTwo(), "max");
            Assert.AreEqual(MaxPowerOfTwo, (MaxPowerOfTwo - 1).CeilingToPowerOfTwo(), "max");
        }

19. Example

View license
[Test]
		public void ShouldWriteAndReadInts(
			[Values(1, 10, 100, 10000, 1000*1000)]
			int numberOfInts)
		{
			var randomInts = Helpers.GetRandomIntegers(numberOfInts);

			var stream = new MemoryStream();
            using(var writer = new PrimitiveWriter(stream, buffered))
			{
				for(var i = 0; i < randomInts.Length; i++)
				{
					writer.Write(randomInts[i]);
				}
			}
			var position = stream.Position;
			stream.Seek(0, SeekOrigin.Begin);

            using(var reader = new PrimitiveReader(stream, buffered))
			{
				for(var i = 0; i < randomInts.Length; i++)
				{
					Assert.AreEqual(randomInts[i], reader.ReadInt32());
				}
			}
			Assert.AreEqual(position, stream.Position, StreamCorruptedMessage);
		}

20. Example

View license
[Test]
		public void ShouldWriteAndReadLongs(
			[Values(1, 10, 100, 10000, 1000*1000)]
			int numberOfLongs)
		{
			var randomLongs = Helpers.GetRandomLongs(numberOfLongs);
			var stream = new MemoryStream();
            using(var writer = new PrimitiveWriter(stream, buffered))
			{
				for(var i = 0; i < randomLongs.Length; i++)
				{
					writer.Write(randomLongs[i]);
				}
			}
			var position = stream.Position;
			stream.Seek(0, SeekOrigin.Begin);

            using(var reader = new PrimitiveReader(stream, buffered))
			{
				for(var i = 0; i < randomLongs.Length; i++)
				{
					var read = reader.ReadInt64();
					Assert.AreEqual(randomLongs[i], read);
				}
			}
			Assert.AreEqual(position, stream.Position, StreamCorruptedMessage);
		}

21. Example

View license
[Test]
        public void ShouldWriteAndReadULongs(
            [Values(1, 10, 100, 10000, 1000*1000)]
            int numberOfULongs)
        {
            var randomULongs = Helpers.GetRandomLongs(numberOfULongs).Select(x=>(ulong)x).ToArray();
            var stream = new MemoryStream();
            using(var writer = new PrimitiveWriter(stream, buffered))
            {
                for(var i = 0; i < randomULongs.Length; i++)
                {
                    writer.Write(randomULongs[i]);
                }
            }
            var position = stream.Position;
            stream.Seek(0, SeekOrigin.Begin);

            using(var reader = new PrimitiveReader(stream, buffered))
            {
                for(var i = 0; i < randomULongs.Length; i++)
                {
                    var read = reader.ReadUInt64();
                    Assert.AreEqual(randomULongs[i], read);
                }
            }
            Assert.AreEqual(position, stream.Position, StreamCorruptedMessage);
        }

22. Example

View license
[Test]
		public void ShouldWriteAndReadStrings(
			[Values(1, 100, 10000)]
			int numberOfStrings,
			[Values(true, false)]
			bool withLongStrings)
		{
			const int maxLength = 100;
			const int longStringLength = 8000;
			const int longStringProbability = 10;

			var random = Helpers.Random;
			var strings = new string[numberOfStrings];
			for(var i = 0; i < strings.Length; i++)
			{
				int length;
				if(withLongStrings && random.Next()%longStringProbability == 0)
				{
					length  = longStringLength;
				}
				else
				{
					length = random.Next(maxLength);
				}
				strings[i] = Helpers.GetRandomString(length);
			}

			var stream = new MemoryStream();
            using(var writer = new PrimitiveWriter(stream, buffered))
			{
				for(var i = 0; i < strings.Length; i++)
				{
					writer.Write(strings[i]);
				}
			}
			var position = stream.Position;
			stream.Seek(0, SeekOrigin.Begin);

            using(var reader = new PrimitiveReader(stream, buffered))
			{
				for(var i = 0; i < strings.Length; i++)
				{
					Assert.AreEqual(strings[i], reader.ReadString());
				}
			}
			Assert.AreEqual(position, stream.Position, StreamCorruptedMessage);
		}

23. Example

View license
[Test]
		public void ShouldWriteAndReadNegativeInt()
		{
			var value = -Helpers.Random.Next();
			var stream = new MemoryStream();
            using(var writer = new PrimitiveWriter(stream, buffered))
			{
				writer.Write(value);
			}
			var position = stream.Position;
			stream.Seek(0, SeekOrigin.Begin);

            using(var reader = new PrimitiveReader(stream, buffered))
			{
				Assert.AreEqual(value, reader.ReadInt32());
			}
			Assert.AreEqual(position, stream.Position, StreamCorruptedMessage);
		}

24. Example

View license
[Test]
		public void ShouldWriteAndReadDoubles(
			[Values(1, 10, 100, 10000, 1000*1000)]
			int numberOfDoubles)
		{
			var randomDoubles = Helpers.GetRandomDoubles(numberOfDoubles);
		
			var stream = new MemoryStream();
            using(var writer = new PrimitiveWriter(stream, buffered))
			{
				for(var i = 0; i < randomDoubles.Length; i++)
				{
					writer.Write(randomDoubles[i]);
				}
			}
			var position = stream.Position;
			stream.Seek(0, SeekOrigin.Begin);

            using(var reader = new PrimitiveReader(stream, buffered))
			{
				for(var i = 0; i < randomDoubles.Length; i++)
				{
					Assert.AreEqual(randomDoubles[i], reader.ReadDouble());
				}
			}
			Assert.AreEqual(position, stream.Position, StreamCorruptedMessage);
		}

25. Example

View license
[Test]
        public void ShouldWriteAndReadDecimal(
            [Values(1, 10, 100, 10000, 1000*1000)]
            int numberOfDecimals)
        {
            var randomDecimals = Helpers.GetRandomDecimals(numberOfDecimals);
            var stream = new MemoryStream();
            using(var writer = new PrimitiveWriter(stream, buffered))
            {
                for(var i = 0; i < randomDecimals.Length; i++)
                {
                    writer.Write(randomDecimals[i]);
                }
            }
            var position = stream.Position;
            stream.Seek(0, SeekOrigin.Begin);

            using(var reader = new PrimitiveReader(stream, buffered))
            {
                for(var i = 0; i < randomDecimals.Length; i++)
                {
                    Assert.AreEqual(randomDecimals[i], reader.ReadDecimal());
                }
            }
            Assert.AreEqual(position, stream.Position, StreamCorruptedMessage);
        }

26. Example

View license
[Test]
		public void ShouldSerializeDateTime(
			[Values(1, 10, 100, 10000)]
			int numberOfEntries)
		{
			var randomDateTimes = Helpers.GetRandomDateTimes(numberOfEntries);
		
			var stream = new MemoryStream();
            using(var writer = new PrimitiveWriter(stream, buffered))
			{
				for(var i = 0; i < randomDateTimes.Length; i++)
				{
					writer.Write(randomDateTimes[i]);
				}
			}
			var position = stream.Position;
			stream.Seek(0, SeekOrigin.Begin);

            using(var reader = new PrimitiveReader(stream, buffered))
			{
				for(var i = 0; i < randomDateTimes.Length; i++)
				{
					Assert.AreEqual(randomDateTimes[i], reader.ReadDateTime());
				}
			}
			Assert.AreEqual(position, stream.Position, StreamCorruptedMessage);
		}

27. Example

View license
[Test]
		public void ShouldSerializeTimeSpan(
			[Values(1, 10, 100, 10000)]
			int numberOfEntries)
		{
			var randomDateTimes = Helpers.GetRandomDateTimes(numberOfEntries);
		
			var stream = new MemoryStream();
            using(var writer = new PrimitiveWriter(stream, buffered))
			{
				for(var i = 0; i < randomDateTimes.Length; i++)
				{
					writer.Write(randomDateTimes[i]);
				}
			}
			var position = stream.Position;
			stream.Seek(0, SeekOrigin.Begin);

            using(var reader = new PrimitiveReader(stream, buffered))
			{
				for(var i = 0; i < randomDateTimes.Length; i++)
				{
					Assert.AreEqual(randomDateTimes[i], reader.ReadDateTime());
				}
			}
			Assert.AreEqual(position, stream.Position, StreamCorruptedMessage);
		}

28. Example

View license
[Test]
		public void ShouldWriteAndReadByteArray(
			[Values(10, 1000, 100000)]
			int count
			)
		{
			var stream = new MemoryStream();
			byte[] array;
            using(var writer = new PrimitiveWriter(stream, buffered))
			{
				array = new byte[count];
				Helpers.Random.NextBytes(array);
				writer.Write(array);
			}
			var position = stream.Position;
			stream.Seek(0, SeekOrigin.Begin);

			byte[] copy;
            using(var reader = new PrimitiveReader(stream, buffered))
			{
				copy = reader.ReadBytes(count);
			}
			CollectionAssert.AreEqual(array, copy);
			Assert.AreEqual(position, stream.Position, StreamCorruptedMessage);
		}

29. Example

View license
[Test]
		public void ShouldReadAndWriteLimits()
		{
			var stream = new MemoryStream();
            /n ..... /n //View Source file for more details /n }

30. Example

View license
[Test]
		public void ShouldHandleNotAlignedWrites()
		{
			const int iterationCount = 80000;
			var stream = new MemoryStream();
            using(var writer = new PrimitiveWriter(stream, buffered))
			{
				writer.Write((byte)1);
				for(var i = 0; i < iterationCount; i++)
				{
					writer.Write(int.MaxValue);
				}
			}
			var position = stream.Position;
			stream.Seek(0, SeekOrigin.Begin);
            using(var reader = new PrimitiveReader(stream, buffered))
			{
				Assert.AreEqual((byte)1, reader.ReadByte());
				for(var i = 0; i < iterationCount; i++)
				{
					Assert.AreEqual(int.MaxValue, reader.ReadInt32());
				}
			}
			Assert.AreEqual(position, stream.Position, StreamCorruptedMessage);
		}

31. Example

Project: DReAM
Source File: EncodingDetectorTest.cs
View license
[Test]
        public void Detect_encoding_for_HTML_file_without_meta() {
            const string resource = "html-bom-utf8.txt";
            using(var stream = GetResourceStream(resource)) {
                var detector = new HtmlMetaEncodingDetector();
                var encoding = detector.Detect(stream);
                var offset = stream.Position;
                Assert.IsNull(encoding, "encoding detection failed");
                Assert.AreEqual(0, offset, "wrong stream position");
            }
        }

32. Example

Project: nhibernate-core
Source File: Int64TypeFixture.cs
View license
[Test]
		public async Task NextAsync()
		{
			Int64Type type = (Int64Type)NHibernateUtil.Int64;
			object current = (long)1;
			object next = await (type.NextAsync(current, null, CancellationToken.None));

			Assert.IsTrue(next is Int64, "Next should be Int64");
			Assert.AreEqual((long)2, (long)next, "current should have been incremented to 2");
		}

33. Example

Project: nhibernate-core
Source File: Int64TypeFixture.cs
View license
[Test]
		public void Next()
		{
			Int64Type type = (Int64Type)NHibernateUtil.Int64;
			object current = (long)1;
			object next = type.Next(current, null);

			Assert.IsTrue(next is Int64, "Next should be Int64");
			Assert.AreEqual((long)2, (long)next, "current should have been incremented to 2");
		}

34. Example

Project: JSON-RPC.NET
Source File: Test.cs
View license
private static void AssertJsonAreEqual(JValue expectedJson, JValue actualJson, string path)
        {
            Assert.AreEqual(expectedJson.Type, actualJson.Type, path);
            switch (expectedJson.Type)
            {
                case JTokenType.Boolean:
                    Assert.AreEqual((bool)expectedJson.Value, (bool)actualJson.Value, path);
                    break;
                case JTokenType.Integer:
                    Assert.AreEqual((System.Int64)expectedJson.Value, (System.Int64)actualJson.Value, path);
                    break;
                case JTokenType.String:
                    Assert.AreEqual((string)expectedJson.Value, (string)actualJson.Value, path);
                    break;
                case JTokenType.Null:
                    //Not used
                    break;
                default:
                    throw new Exception("I don't know how to handle type " + expectedJson.Type.ToString());
            }
        }

35. Example

View license
[Test]
		public void PublishLast ()
		{
			var scheduler = new HistoricalScheduler ();
			var hot = Observable.Interval (TimeSpan.FromMilliseconds (20), scheduler).Skip (4).Take (2).PublishLast ();
			hot.Connect ();
			var observable = hot.Replay ();
			observable.Connect ();
			long result = 0;
			var dis = observable.Subscribe (i => result += i);
			scheduler.AdvanceBy (TimeSpan.FromSeconds (1));
			Assert.AreEqual (5, result, "#1");
			dis.Dispose ();
			var dis2 = observable.Subscribe (i => result += i);
			Assert.AreEqual (10, result, "#2");
			dis2.Dispose ();
		}

36. Example

Project: Bless
Source File: SegmentCollectionTests.cs
View license
[Test]
	public void InsertToSegmentCollectionThenDeleteTest() {
		SegmentCollection segs1 = new SegmentCollection();
		Segment s1, s2;
		s1 = new Segment(buf1, 0, 2);
		s2 = new Segment(buf1, 3, 5);
		segs1.Append(s1);
		SegmentCollection segs2 = new SegmentCollection();
		segs2.Append(s2);
		segs1.Insert(segs2, 2);

		segs1.DeleteRange(2, 4);

		long map;
		List<Segment>.Node n;
		Segment s = segs1.FindSegment(0, out map, out n);
		Assert.IsNotNull(s, "#1");
		Assert.AreEqual(0, map, "#2");
		Assert.AreEqual(0, s.Start, "#3");



	}

37. Example

Project: ContinuousTests
Source File: CSharpTest.cs
View license
[Test] public void Equals() 
		{
			Assert.AreEqual(12, 12, "Integer");
			Assert.AreEqual(12L, 12L, "Long");
			Assert.AreEqual('a', 'a', "Char");
			Assert.AreEqual((object)12, (object)12, "Integer Object Cast");
            
			Assert.AreEqual(12, 13, "Expected Failure (Integer)");
			Assert.AreEqual(12.0, 11.99, 0.0, "Expected Failure (Double).");
		}

38. Example

Project: ContinuousTests
Source File: CSharpTest.cs
View license
[Test] public void Equals() 
		{
			Assert.AreEqual(12, 12, "Integer");
			Assert.AreEqual(12L, 12L, "Long");
			Assert.AreEqual('a', 'a', "Char");
			Assert.AreEqual((object)12, (object)12, "Integer Object Cast");
            
			Assert.AreEqual(12, 13, "Expected Failure (Integer)");
			Assert.AreEqual(12.0, 11.99, 0.0, "Expected Failure (Double).");
		}

39. Example

Project: ContinuousTests
Source File: CSharpTest.cs
View license
[Test] public void Equals() 
		{
			Assert.AreEqual(12, 12, "Integer");
			Assert.AreEqual(12L, 12L, "Long");
			Assert.AreEqual('a', 'a', "Char");
			Assert.AreEqual((object)12, (object)12, "Integer Object Cast");
            
			Assert.AreEqual(12, 13, "Expected Failure (Integer)");
			Assert.AreEqual(12.0, 11.99, 0.0, "Expected Failure (Double).");
		}

40. Example

Project: ContinuousTests
Source File: CSharpTest.cs
View license
[Test] public void Equals() 
		{
			Assert.AreEqual(12, 12, "Integer");
			Assert.AreEqual(12L, 12L, "Long");
			Assert.AreEqual('a', 'a', "Char");
			Assert.AreEqual((object)12, (object)12, "Integer Object Cast");
            
			Assert.AreEqual(12, 13, "Expected Failure (Integer)");
			Assert.AreEqual(12.0, 11.99, 0.0, "Expected Failure (Double).");
		}

41. Example

Project: ContinuousTests
Source File: CSharpTest.cs
View license
[Test] public void Equals() 
		{
			Assert.AreEqual(12, 12, "Integer");
			Assert.AreEqual(12L, 12L, "Long");
			Assert.AreEqual('a', 'a', "Char");
			Assert.AreEqual((object)12, (object)12, "Integer Object Cast");
            
			Assert.AreEqual(12, 13, "Expected Failure (Integer)");
			Assert.AreEqual(12.0, 11.99, 0.0, "Expected Failure (Double).");
		}

42. Example

Project: MimeKit
Source File: ChainedStreamTests.cs
View license
[Test]
		public void TestSeekingToStreamBoundaries ()
		{
			long expected, actual;

			// first, seek to the beginning
			expected = master.Seek (0, SeekOrigin.Begin);
			actual = chained.Seek (0, SeekOrigin.Begin);

			Assert.AreEqual (expected, actual, "Seeking the chained stream did not return the expected position");

			AssertSeekResults ("seeking to the beginning");

			// now seek to the second boundary
			expected = master.Seek (lengths[1], SeekOrigin.Begin);
			actual = chained.Seek (lengths[1], SeekOrigin.Begin);

			Assert.AreEqual (expected, actual, "Seeking the chained stream did not return the expected position");

			AssertSeekResults ("seeking to the second boundary");

			// now seek to the first boundary
			expected = master.Seek (lengths[0], SeekOrigin.Begin);
			actual = chained.Seek (lengths[0], SeekOrigin.Begin);

			Assert.AreEqual (expected, actual, "Seeking the chained stream did not return the expected position");

			AssertSeekResults ("seeking to the first boundary");
		}

43. Example

Project: MimeKit
Source File: MemoryBlockStreamTests.cs
View license
[Test]
		public void TestRead ()
		{
			blocks.Position = 0;
			master.Position = 0;

			do {
				int nread = blocks.Read (buf, 0, buf.Length);
				int mread = master.Read (mbuf, 0, mbuf.Length);

				Assert.AreEqual (mread, nread, "Did not read the expected number of bytes from the memory block stream");
				Assert.AreEqual (master.Position, blocks.Position, "The memory block stream's position did not match");

				for (int i = 0; i < mread; i++)
					Assert.AreEqual (mbuf[i], buf[i], "The bytes read do not match");
			} while (master.Position < master.Length);
		}

44. Example

Project: MimeKit
Source File: MemoryBlockStreamTests.cs
View license
[Test]
		public async void TestReadAsync ()
		{
			blocks.Position = 0;
			master.Position = 0;

			do {
				int nread = await blocks.ReadAsync (buf, 0, buf.Length);
				int mread = await master.ReadAsync (mbuf, 0, mbuf.Length);

				Assert.AreEqual (mread, nread, "Did not read the expected number of bytes from the memory block stream");
				Assert.AreEqual (master.Position, blocks.Position, "The memory block stream's position did not match");

				for (int i = 0; i < mread; i++)
					Assert.AreEqual (mbuf[i], buf[i], "The bytes read do not match");
			} while (master.Position < master.Length);
		}

45. Example

Project: grisu.net
Source File: CSharpTest.cs
View license
[Test] public void Equals() 
		{
			Assert.AreEqual(12, 12, "Integer");
			Assert.AreEqual(12L, 12L, "Long");
			Assert.AreEqual('a', 'a', "Char");
			Assert.AreEqual((object)12, (object)12, "Integer Object Cast");
            
			Assert.AreEqual(12, 13, "Expected Failure (Integer)");
			Assert.AreEqual(12.0, 11.99, 0.0, "Expected Failure (Double).");
		}

46. Example

View license
[Test]
		public void ShouldWriteAndReadGuid(
			[Values(10, 1000, 100000)]
			int count
			)
		{
			var stream = new MemoryStream();
			var array = new Guid[count];
            using(var writer = new PrimitiveWriter(stream, buffered))
			{
				for(var i = 0; i < count; i++)
				{
					var guid = Guid.NewGuid();
					array[i] = guid;
					writer.Write(guid);
				}
			}
			var position = stream.Position;
			stream.Seek(0, SeekOrigin.Begin);

            using(var reader = new PrimitiveReader(stream, buffered))
			{
				for(var i = 0; i < count; i++)
				{
					Assert.AreEqual(array[i], reader.ReadGuid());
				}
			}
			Assert.AreEqual(position, stream.Position, StreamCorruptedMessage);
		}

47. Example

View license
protected override void Release(ISession session)
		{
			long initialCount = Sfi.Statistics.SessionCloseCount;
			session.Transaction.Commit();
			long subsequentCount = Sfi.Statistics.SessionCloseCount;
			Assert.AreEqual(initialCount + 1, subsequentCount, "Session still open after commit");
			// also make sure it was cleaned up from the internal ThreadLocal...
			Assert.IsFalse(TestableThreadLocalContext.HasBind(), "session still bound to internal ThreadLocal");
		}

48. Example

Project: Pash
Source File: CSharpTest.cs
View license
[Test] public void Equals() 
		{
			Assert.AreEqual(12, 12, "Integer");
			Assert.AreEqual(12L, 12L, "Long");
			Assert.AreEqual('a', 'a', "Char");
			Assert.AreEqual((object)12, (object)12, "Integer Object Cast");
            
			Assert.AreEqual(12, 13, "Expected Failure (Integer)");
			Assert.AreEqual(12.0, 11.99, 0.0, "Expected Failure (Double).");
		}

49. Example

Project: pgina
Source File: RollingFileAppenderTest.cs
View license
private void VerifyExistenceAndRemoveFromList( ArrayList alExisting, string sFileName, FileInfo file, RollFileEntry entry )
		{
			Assert.IsTrue(alExisting.Contains( sFileName ), "filename {0} not found in test directory", sFileName);
			Assert.AreEqual(entry.FileLength, file.Length, "file length mismatch");
			// Remove this file from the list
			alExisting.Remove( sFileName );
		}

50. Example

Project: Spreads
Source File: SortedChunkedMapTests.cs
View license
[Test]
        public void CouldRemoveFirst2() {
            var scm = new SortedChunkedMap<int, int>();
            for (int i = 0; i < 10000; i++) {
                scm.Add(i, i);
            }
            Assert.AreEqual(10000, scm.Count, "Count is not equal");
            KeyValuePair<int, int> result;
            var removed = scm.RemoveFirst(out result);
            Assert.IsTrue(removed);
            Assert.IsTrue(!scm.IsEmpty);
            Assert.IsTrue(scm.Count == 9999);
            Assert.IsTrue(scm.First.Key == 1);
        }