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
0
1. Example
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 "); } }
0
2. Example
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"); }
0
3. Example
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"); }
0
4. Example
View licenseprivate void AssertCtxInfraCountPerCode(long[] expectedCountPerCode) { for (var i = 0; i < expectedCountPerCode.Length; i++) { Assert.AreEqual(expectedCountPerCode[i], GetCtxInfraCount(i), "for code " + i); } }
0
5. Example
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)); }
0
6. Example
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)"); }
0
7. Example
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)"); }
0
8. Example
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)"); }
0
9. Example
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"); }
0
10. Example
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)"); }
0
11. Example
View license[Test] public void ListGcdHandlesSpecialInputCorrectly() { Assert.AreEqual(0, Euclid.GreatestCommonDivisor(new long[0]), "Gcd()"); Assert.AreEqual(100, Euclid.GreatestCommonDivisor(-100), "Gcd(-100)"); }
0
12. Example
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)"); }
0
13. Example
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)"); }
0
14. Example
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)"); }
0
15. Example
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)"); }
0
16. Example
View license[Test] public void ListLcmHandlesSpecialInputCorrectly() { Assert.AreEqual(1, Euclid.LeastCommonMultiple(new long[0]), "Lcm()"); Assert.AreEqual(100, Euclid.LeastCommonMultiple(-100), "Lcm(-100)"); }
0
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"); }
0
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"); }
0
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); }
0
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); }
0
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); }
0
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); }
0
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); }
0
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); }
0
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); }
0
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); }
0
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); }
0
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); }
0
29. Example
View license[Test] public void ShouldReadAndWriteLimits() { var stream = new MemoryStream(); /n ..... /n //View Source file for more details /n }
0
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); }
0
31. Example
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"); } }
0
32. Example
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"); }
0
33. Example
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"); }
0
34. Example
View licenseprivate 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()); } }
0
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 (); }
0
36. Example
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"); }
0
37. Example
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)."); }
0
38. Example
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)."); }
0
39. Example
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)."); }
0
40. Example
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)."); }
0
41. Example
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)."); }
0
42. Example
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"); }
0
43. Example
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); }
0
44. Example
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); }
0
45. Example
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)."); }
0
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); }
0
47. Example
View licenseprotected 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"); }
0
48. Example
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)."); }
0
49. Example
View licenseprivate 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 ); }
0
50. Example
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); }