Here are the examples of the csharp api class NUnit.Framework.Assert.AreEqual(int, int, string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
200 Examples
0
1. Example
View license[Test] public void Should_CRUD_File_Successfully() { Events.MediaManager/n ..... /n //View Source file for more details /n }
0
2. Example
View license[Test] public void Should_CRUD_Folder_Successfully() { // Attach to events. Events.MediaManagerEvents.Instance.MediaFolderCreated += Instance_EntityCreated; Events.MediaManagerEvents.Instance.MediaFolderUpdated += Instance_EntityUpdated; Events.MediaManagerEvents.Instance.MediaFolderDeleted += Instance_EntityDeleted; Events.MediaManagerEvents.Instance.MediaArchived += Instance_MediaArchived; Events.MediaManagerEvents.Instance.MediaUnarchived += Instance_MediaUnarchived; RunApiActionInTransaction((api, session) => Run(session, api.Media.Folders.Post, api.Media.Folder.Get, api.Media.Folder.Put, api.Media.Folder.Delete)); Assert.AreEqual(1, archivedMediaEventCount, "Archived media events fired count"); Assert.AreEqual(1, unarchivedMediaEventCount, "Unarchived media events fired count"); // Detach from events. Events.MediaManagerEvents.Instance.MediaFolderCreated -= Instance_EntityCreated; Events.MediaManagerEvents.Instance.MediaFolderUpdated -= Instance_EntityUpdated; Events.MediaManagerEvents.Instance.MediaFolderDeleted -= Instance_EntityDeleted; Events.MediaManagerEvents.Instance.MediaArchived -= Instance_MediaArchived; Events.MediaManagerEvents.Instance.MediaUnarchived -= Instance_MediaUnarchived; }
0
3. Example
View license[Test] public void Should_CRUD_Image_Successfully() { Events.MediaManage/n ..... /n //View Source file for more details /n }
0
4. Example
View licenseprotected override void CheckCreateEvent() { CheckEventsCount(1, 0, 0); Assert.AreEqual(contentConfigredCount, setOptions ? 1 : 0, "Content configured events count"); }
0
5. Example
View licenseprotected override void CheckUpdateEvent() { CheckEventsCount(1, updateOrder ? 1 : 0, 0); Assert.AreEqual(contentConfigredCount, setOptions ? 2 : 0, "Content configured events count"); }
0
6. Example
View license[Test] public void Should_CRUD_PageProperties_WithLayout_Successfully() { /n ..... /n //View Source file for more details /n }
0
7. Example
View license[Test] public void Should_CRUD_PageProperties_WithMasterPage_Successfully() { /n ..... /n //View Source file for more details /n }
0
8. Example
View license[Test] public void Should_CRUD_Node_Successfully() { // Attach to events Events.SitemapEvents.Instance.SitemapUpdated += Instance_SitemapUpdated; Events.SitemapEvents.Instance.SitemapNodeCreated += Instance_EntityCreated; Events.SitemapEvents.Instance.SitemapNodeUpdated += Instance_EntityUpdated; Events.SitemapEvents.Instance.SitemapNodeDeleted += Instance_EntityDeleted; RunApiActionInTransaction( (api, session) => { var sitemap = this.TestDataProvider.CreateNewSitemap(); session.SaveOrUpdate(sitemap); session.Flush(); SitemapId = sitemap.Id; Run(session, api.Pages.SitemapNew.Nodes.Post, api.Pages.SitemapNew.Node.Get, api.Pages.SitemapNew.Node.Put, api.Pages.SitemapNew.Node.Delete); }); Assert.AreEqual(3, updatedSitemapEventCount, "Updated sitemap events fired count"); // Detach from events Events.SitemapEvents.Instance.SitemapNodeCreated -= Instance_EntityCreated; Events.SitemapEvents.Instance.SitemapNodeUpdated -= Instance_EntityUpdated; Events.SitemapEvents.Instance.SitemapNodeDeleted -= Instance_EntityDeleted; }
0
9. Example
View license[Test] public void Should_CRUD_Sitemap_Successfully() { // Attach to events Events.SitemapEvents.Instance.SitemapCreated += Instance_EntityCreated; Events.SitemapEvents.Instance.SitemapUpdated += Instance_EntityUpdated; Events.SitemapEvents.Instance.SitemapDeleted += Instance_EntityDeleted; Events.SitemapEvents.Instance.SitemapNodeCreated += Instance_SitemapNodeCreated; Events.SitemapEvents.Instance.SitemapNodeDeleted += Instance_SitemapNodeDeleted; RunApiActionInTransaction((api, session) => Run(session, api.Pages.Sitemaps.Post, api.Pages.SitemapNew.Get, api.Pages.SitemapNew.Put, api.Pages.SitemapNew.Delete)); Assert.AreEqual(2, createdNodeEventCount, "Created node events fired count"); Assert.AreEqual(1, deletedNodeEventCount, "Deleted node events fired count"); // Detach from events Events.SitemapEvents.Instance.SitemapCreated -= Instance_EntityCreated; Events.SitemapEvents.Instance.SitemapUpdated -= Instance_EntityUpdated; Events.SitemapEvents.Instance.SitemapDeleted -= Instance_EntityDeleted; Events.SitemapEvents.Instance.SitemapNodeCreated -= Instance_SitemapNodeCreated; Events.SitemapEvents.Instance.SitemapNodeDeleted += Instance_SitemapNodeDeleted; }
0
10. Example
View license[Test] public void Should_CRUD_Node_Successfully() { // Attach to events Events.RootEvents.Instance.CategoryTreeUpdated += Instance_SitemapUpdated; Events.RootEvents.Instance.CategoryCreated += Instance_EntityCreated; Events.RootEvents.Instance.CategoryUpdated += Instance_EntityUpdated; Events.RootEvents.Instance.CategoryDeleted += Instance_EntityDeleted; RunApiActionInTransaction( (api, session) => { var categoryTree = this.TestDataProvider.CreateNewCategoryTree(); session.SaveOrUpdate(categoryTree); session.Flush(); CategoryTreeId = categoryTree.Id; Run(session, api.Root.Category.Nodes.Post, api.Root.Category.Node.Get, api.Root.Category.Node.Put, api.Root.Category.Node.Delete); }); Assert.AreEqual(3, updatedCategoryTreeEventCount, "Updated category tree events fired count"); // Detach from events Events.RootEvents.Instance.CategoryCreated -= Instance_EntityCreated; Events.RootEvents.Instance.CategoryUpdated -= Instance_EntityUpdated; Events.RootEvents.Instance.CategoryDeleted -= Instance_EntityDeleted; }
0
11. Example
View license[Test] public void Should_CRUD_CategoryTree_Successfully() { // Attach to events RootEvents.Instance.CategoryTreeCreated += Instance_EntityCreated; RootEvents.Instance.CategoryTreeUpdated += Instance_EntityUpdated; RootEvents.Instance.CategoryTreeDeleted += Instance_EntityDeleted; RootEvents.Instance.CategoryCreated += Instance_CategoryNodeCreated; RootEvents.Instance.CategoryDeleted += Instance_CategoryNodeDeleted; RunApiActionInTransaction((api, session) => Run(session, api.Root.Categories.Post, api.Root.Category.Get, api.Root.Category.Put, api.Root.Category.Delete)); Assert.AreEqual(2, createdNodeEventCount, "Created node events fired count"); Assert.AreEqual(1, deletedNodeEventCount, "Deleted node events fired count"); // Detach from events RootEvents.Instance.CategoryTreeCreated -= Instance_EntityCreated; RootEvents.Instance.CategoryTreeUpdated -= Instance_EntityUpdated; RootEvents.Instance.CategoryTreeDeleted -= Instance_EntityDeleted; RootEvents.Instance.CategoryCreated -= Instance_CategoryNodeCreated; RootEvents.Instance.CategoryDeleted += Instance_CategoryNodeDeleted; }
0
12. Example
View licenseprotected void CheckEventsCount(int expectedCreatedCount, int expectedUpdatedCount, int expectedDeletedCount) { Assert.AreEqual(expectedCreatedCount, createdEventCount, "Created events fired count"); Assert.AreEqual(expectedUpdatedCount, updatedEventCount, "Updated events fired count"); Assert.AreEqual(expectedDeletedCount, deletedEventCount, "Deleted events fired count"); }
0
13. Example
View license[Test] public void AsInt_int_evaluates_to_expected_value() { const int expected = 10; var systemUnderTest = new ValueObject(expected); Assert.AreEqual(expected, systemUnderTest.AsInt, "AsInt should return the value of the wrapped integer."); }
0
14. Example
View licenseprivate void CompareData(Record record, String message) { byte[] recData = record.Serialize(); for (int i = 0; i < recData.Length; i++) { Assert.AreEqual(recData[i], data[offset[0]++], message + " data byte " + i); } }
0
15. Example
View license[Test] public void TestGetSid() { DConRefRecord instance = new DConRefRecord(TestcaseRecordInputStream.Create(81, data1)); short expResult = 81; short result = instance.Sid; Assert.AreEqual(expResult, result, "SID"); }
0
16. Example
View license[Test] public void Bug50298() { HSSFWorkbook wb = HSSFTestDataSamples.OpenSampleWorkbook("50298.xls"); assertSheetOrder(wb, "Invoice", "Invoice1", "Digest", "Deferred", "Received"); ISheet sheet = wb.CloneSheet(0); assertSheetOrder(wb, "Invoice", "Invoice1", "Digest", "Deferred", "Received", "Invoice (2)"); wb.SetSheetName(wb.GetSheetIndex(sheet), "copy"); assertSheetOrder(wb, "Invoice", "Invoice1", "Digest", "Deferred", "Received", "copy"); wb.SetSheetOrder("copy", 0); assertSheetOrder(wb, "copy", "Invoice", "Invoice1", "Digest", "Deferred", "Received"); wb.RemoveSheetAt(0); assertSheetOrder(wb, "Invoice", "Invoice1", "Digest", "Deferred", "Received"); // check that the overall workbook serializes with its correct size int expected = wb.Workbook.Size; int written = wb.Workbook.Serialize(0, new byte[expected * 2]); Assert.AreEqual(expected, written, "Did not have the expected size when writing the workbook: written: " + written + ", but expected: " + expected); HSSFWorkbook read = HSSFTestDataSamples.WriteOutAndReadBack(wb); assertSheetOrder(read, "Invoice", "Invoice1", "Digest", "Deferred", "Received"); }
0
17. Example
View license[Test] public void Bug50298a() { HSSFWorkbook wb = HSSFTestDataSamples.O/n ..... /n //View Source file for more details /n }
0
18. Example
View licenseprotected static void assertBATCount(NPOIFSFileSystem fs, int expectedBAT, int expectedXBAT) { int foundBAT = 0; int foundXBAT = 0; int sz = (int)(fs.Size / fs.GetBigBlockSize()); for (int i = 0; i < sz; i++) { if (fs.GetNextBlock(i) == POIFSConstants.FAT_SECTOR_BLOCK) { foundBAT++; } if (fs.GetNextBlock(i) == POIFSConstants.DIFAT_SECTOR_BLOCK) { foundXBAT++; } } Assert.AreEqual(expectedBAT, foundBAT, "Wrong number of BATs"); Assert.AreEqual(expectedXBAT, foundXBAT, "Wrong number of XBATs with " + expectedBAT + " BATs"); }
0
19. Example
View license[Test] public void TestRead() { DocumentBlock[] blocks = new DocumentBlock[4]; MemoryStream input = new MemoryStream(_testdata); for (int j = 0; j < 4; j++) { blocks[j] = new DocumentBlock(input, POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS); } for (int j = 1; j <= 2000; j += 17) { byte[] buffer = new byte[j]; int offset = 0; for (int k = 0; k < (2000 / j); k++) { DocumentBlock.Read(blocks, buffer, offset); for (int n = 0; n < buffer.Length; n++) { Assert.AreEqual(_testdata[(k * j) + n], buffer[n] , "checking byte " + (k * j) + n); } offset += j; } } }
0
20. Example
View license[Test] public void TestWriteToBytes() { ByteField field = new ByteField(0); byte[] array = new byte[ 1 ]; for (int j = 0; j < _test_array.Length; j++) { field.Value=_test_array[ j ]; field.WriteToBytes(array); Assert.AreEqual(_test_array[j], array[0], "testing "); } }
0
21. Example
View license[Test] public void TestWriteToBytes() { IntegerField field = new IntegerField(0); byte[] array = new byte[ 4 ]; for (int j = 0; j < _test_array.Length; j++) { field.Value=_test_array[ j ]; field.WriteToBytes(array); int val = array[ 3 ] << 24; val &= unchecked((int)0xFF000000); val += (array[ 2 ] << 16) & 0x00FF0000; val += (array[ 1 ] << 8) & 0x0000FF00; val += (array[ 0 ] & 0x000000FF); Assert.AreEqual(_test_array[j], val, "testing "); } }
0
22. Example
View license[Test] public void TestWriteToBytes() { ShortField field = new ShortField(0); byte[] array = new byte[2]; for (int j = 0; j < _test_array.Length; j++) { field.Value = _test_array[j]; field.WriteToBytes(array); short val = (short)(array[1] << 8); val &= unchecked((short)0xFF00); val += (short)(array[0] & 0x00FF); Assert.AreEqual(_test_array[j], val, "testing "); } }
0
23. Example
View license[TestMethod] public void RemoveFeedThatIsNotInTheListDoesNothing() { FeedManager.ClearFeeds(); Feed feed = new Feed { Name = "sample feed", Url = "https://example.com" }; FeedManager.Add(feed); var before = FeedManager.GetFeeds(); FeedManager.Remove(feed); var after = FeedManager.GetFeeds(); Assert.AreEqual(before.Count(), after.Count(), "The number of feeds should be the same if an attempt is made to remove a feed that is not in the list."); }
0
24. Example
View license[Test] public void IndexOfAny_NoMatches_EmptyCollection() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); int index = subs.IndexOfAny( new string[] { "FIND1", "FIND2", "FIND3" }); Assert.AreEqual( -1, index, "No matches should have been found."); }
0
25. Example
View license[Test] public void IndexOfAny_NoMatches_PopulatedCollection() { vCardSubpropertyCollection subs = new vCardSubpropertyCollection(); subs.Add("NAME1"); subs.Add("NAME2"); subs.Add("NAME3"); int index = subs.IndexOfAny( new string[] { "FIND1", "FIND2", "FIND3" }); Assert.AreEqual( -1, index, "No matches should have been found."); }
0
26. Example
View licensepublic void AreEqual_should_have_message_original_message() { var expected = 1; var actual = 2; Assert.AreEqual(expected, actual, "original_message"); }
0
27. Example
View licensevoid Verify(byte[] buffer, int startOffset, int count, byte expected) { for (int i = startOffset; i < startOffset + count; i++) Assert.AreEqual(buffer[i], expected, "#" + i); }
0
28. Example
View license[Test] public void CorruptDictionary() { BEncodedList l = new BEncodedList(); BEncodedDictionary d = new BEncodedDictionary(); l.Add(d); IList<Peer> decoded = Peer.Decode(l); Assert.AreEqual(0, decoded.Count, "#1"); }
0
29. Example
View license[Test] public void CorruptString() { IList<Peer> p = Peer.Decode((BEncodedString)"1234"); Assert.AreEqual(0, p.Count, "#1"); byte[] b = new byte[] { 255, 255, 255, 255, 255, 255 }; p = Peer.Decode((BEncodedString)b); Assert.AreEqual(1, p.Count, "#2"); b = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; p = Peer.Decode((BEncodedString)b); Assert.AreEqual(1, p.Count, "#3"); }
0
30. Example
View license[Test] public void TestAllDefinedCharsetMappingRows() { int numberSuccessful, numberFailed; String resultText = LanguageBaseItem.TestAllDefinedEncodingMappingRows(out numberSuccessful, out numberFailed); int successExpected = 16; int failedExpected = 3; #if NETCF successExpected = 10; failedExpected = 9; #endif Assert.AreEqual(successExpected, numberSuccessful, "numberSuccessful"); Assert.AreEqual(failedExpected, numberFailed, "numberFailed"); //-Console.WriteLine(resultText); }
0
31. Example
View licensepublic void AssertOpenServerNotCalled() { Assert.AreEqual(0, m_OpenServerCalled, "NOT OpenServerCalled"); }
0
32. Example
View licensepublic void AssertOpenServerCalledAndClear(byte channel) { Assert.AreEqual(1, m_OpenServerCalled, "OpenServerCalled"); //Assert.AreEqual(address, m_ocAddress, "Address"); //Assert.AreEqual(channel, m_ocScn, "Channel"); // m_OpenServerCalled = 0; //... }
0
33. Example
View licensestatic public void AssertEquals(string message, int expected, int actual) { NUnit.Framework.Assert.AreEqual(expected, actual, message); }
0
34. Example
View licensestatic public void AssertEquals(string message, int expected, int actual) { NUnit.Framework.Assert.AreEqual(expected, actual, message); }
0
35. Example
View license[Test] public void Execute_MultipleInvocation() { string singleExp = _codeSnippets[CodeType.SimpleExpressionOnePlusOne]; int expResult = 2; ScriptSource source = _testEng.CreateScriptSourceFromString(singleExp, SourceCodeKind.Expression); int testRuns = 10; object result; for (int i = 0; i < testRuns; i++) { result = source.Execute(_testEng.CreateScope()); Assert.AreEqual(expResult, (int)result, "Test Multiple Calls to Execute"); } }
0
36. Example
View license[Test] public void CanParseNestedComments() { const string script = @"/* select 1 /* nested comment */ go delete from users -- */"; var scripts = new ScriptSplitter(script); Assert.AreEqual(1, scripts.Count(), "This contains a comment and no scripts."); }
0
37. Example
View license[Test] public void CanParseSuccessiveGoStatements() { const string script = @"GO GO"; var scripts = new ScriptSplitter(script); Assert.AreEqual(0, scripts.Count(), "Expected no scripts since they would be empty."); }
0
38. Example
View license[Test] public void SemiColonDoesNotSplitScript() { const string script = "CREATE PROC Blah AS SELECT FOO; SELECT Bar;"; var scripts = new ScriptSplitter(script); Assert.AreEqual(1, scripts.Count(), "Expected no scripts since they would be empty."); }
0
39. Example
View licenseprivate static void AssertLineCounters(BufferedCharReader reader, int line, int pos) { Assert.AreEqual(line, reader.LineNumber, "LineNumber"); Assert.AreEqual(pos, reader.LinePosition, "LinePosition"); }
0
40. Example
View license[Test, DataContextSource(false)] public void MutiplySelect12(string context) { using (var db = GetDataContext(context)) { var q = from grandChild in db.GrandChild from child in db.Child where grandChild.ChildID.HasValue select grandChild; q.ToList(); var selectCount = ((DataConnection)db).LastQuery .Split(' ', '\t', '\n', '\r') .Count(s => s.Equals("select", StringComparison.OrdinalIgnoreCase)); Assert.AreEqual(1, selectCount, "Why do we need \"select from select\"??"); } }
0
41. Example
View license[Test] public void Split_can_handle_one_element() { // Arrange var array = new[] { 1 }; // Act var chunks = array.Split(100); // Assert Assert.AreEqual(1, chunks.Count(), "There should only be one chunk"); Assert.AreEqual(1, chunks.First().Count(), "Chunk should only contain one element"); }
0
42. Example
View license[Test] public void ForEachTest() { var _dictionary = new MessagePackObjectDictionary(); _dictionary.Add( "key1", "value1" ); _dictionary.Add( "key2", "value2" ); _dictionary.Add( "key3", "value3" ); _dictionary.Add( "key4", "value4" ); int i = 0; foreach ( KeyValuePair<MessagePackObject, MessagePackObject> entry in _dictionary ) i++; Assert.AreEqual( 4, i, "fail1: foreach entry failed!" ); i = 0; foreach ( KeyValuePair<MessagePackObject, MessagePackObject> entry in ( ( IEnumerable )_dictionary ) ) i++; Assert.AreEqual( 4, i, "fail2: foreach entry failed!" ); i = 0; foreach ( DictionaryEntry entry in ( ( IDictionary )_dictionary ) ) i++; Assert.AreEqual( 4, i, "fail3: foreach entry failed!" ); }
0
43. Example
View licensepublic static void Count(int count, IEnumerable list) { int i = 0; foreach (object o in list) ++i; Assert.AreEqual(count, i, "Expected list count " + count + " but was " + i); }
0
44. Example
View licenseprotected void AssertNoPersons() { using (var s = OpenSession()) using (var t = s.BeginTransaction()) { Assert.AreEqual(0, s.Query<Person>().Count(), "Entities found in database."); t.Commit(); } }
0
45. Example
View licensepublic static void AreEqual(DateTime expected, DateTime actual, bool useMilliseconds) { Assert.AreEqual(expected.Year, actual.Year, "Year"); Assert.AreEqual(expected.Month, actual.Month, "Month"); Assert.AreEqual(expected.Day, actual.Day, "Day"); Assert.AreEqual(expected.Hour, actual.Hour, "Hour"); Assert.AreEqual(expected.Minute, actual.Minute, "Minute"); Assert.AreEqual(expected.Second, actual.Second, "Second"); if (useMilliseconds) Assert.AreEqual(expected.Millisecond, actual.Millisecond, "Millisecond"); }
0
46. Example
View license[Test] public void use_sheetData_where_null() { var factory = new ExcelQueryFactory(_excelFileName + "x", new LogManagerFactory()); var companies = from c in factory.NamedRange<Company>("NullCellCompanies") where c.EmployeeCount == null select c; Assert.AreEqual(2, companies.Count(), "Count"); }
0
47. Example
View license[Test] public void use_row_where_null() { var factory = new ExcelQueryFactory(_excelFileName + "x", new LogManagerFactory()); var companies = from c in factory.NamedRange("NullCellCompanies") where c["EmployeeCount"] == null select c; Assert.AreEqual(2, companies.Count(), "Count"); }
0
48. Example
View license[Test] public void use_row_no_header_where_null() { var factory = new ExcelQueryFactory(_excelFileName + "x", new LogManagerFactory()); var companies = from c in factory.NamedRangeNoHeader("NullCellCompanies") where c[2] == null select c; Assert.AreEqual(2, companies.Count(), "Count"); }
0
49. Example
View license[Test] public void use_sheetData_where_null() { var factory = new ExcelQueryFactory(_excelFileName + "x", new LogManagerFactory()); var companies = from c in factory.WorksheetRange<Company>("A1", "D4", "NullCells") where c.EmployeeCount == null select c; Assert.AreEqual(2, companies.Count(), "Count"); }
0
50. Example
View license[Test] public void use_row_where_null() { var factory = new ExcelQueryFactory(_excelFileName + "x", new LogManagerFactory()); var companies = from c in factory.WorksheetRange("A1", "D4", "NullCells") where c["EmployeeCount"] == null select c; Assert.AreEqual(2, companies.Count(), "Count"); }