Nunit Assertion For An Empty Intersection Between Collection

Dec 21, 2010

I have a list of user names (we'll call 'original list') one object is returning. I have a list of user names (we'll call 'filtration list') another object is returning. I am testing a method that returns all of the items from the original list not in the filtration list. Ideally what I want is something like:

Assert.That(returnedList, Has.No.Members.In(filtrationList))

So far the only thing I can do is iterate over the filtrationList and do

Assert.That(returnedList, Has.None.EqualTo(filteredUser))

View 1 Replies


ADVERTISEMENT

Collection And Picturebox Intersection?

Jan 8, 2009

(VB 2008) ok im making space invaders for a midterm project, that is i made space invaders and then lost my thumb drive, WITHOUT BACKING UP ANY OF MY PROJECTS. point is its due tomorrow and im having trouble with one of my methods. i have a collection that stores all the missles the enemy shoots, then i have a collection that stores each picture box that makes up the barriers. my method is supposed to search thro both collections and check to see if they intersect. if they are both visible they become invisible creating an illusion that they dissappear. i hav organized the rest of my code to ignore the missles and barriers if they are invisible but this part isnt working for some reason.

[Code]...

View 3 Replies

VS 2008 : Empty A Collection In .NET?

Apr 11, 2010

How can I empty a collection in .NET? Let me specify that I don't want to destroy the collection , I just don't want it to have the objects it had before (so I can refill it from scratch) .

View 3 Replies

Check If A String Collection Is Empty?

Aug 19, 2009

How can i check if a string collection is empty? I tried

VB.NET
My.Settings.IPBank.Count = 0
But it said

Quote:

Object reference not set to an instance of an object.

View 6 Replies

[2008] - Deserialize An Empty Arraylist Collection?

Mar 6, 2009

the vars outside the procedure

Dim rentalRecords As New ArrayList() ' The arraylist containing the records
Dim carRecords As New ArrayList()
Dim currentRecordIndex As Integer ' The index of the current record

[code]....

View 1 Replies

TreeView.nodes Sometimes Returns An Empty Node Collection?

Jul 1, 2009

treeView control which has been plaguing me for the last few days.

I'm not exactly sure what is causing this problem to arise, so I will just explain what my program is trying to do.

I am building an application which will have plugin support. I have created a Plugin interface, which is implemented by each plugin, as well as a host interface, which is implemented only by the host application.

Each plugin has an Action subroutine, and when finished, it is supposed to call the ExecutionComplete subroutine in the host interface.

Now, onto the problem. I have a treeView on the host form, which has several nodes in it. If I create a button on the form which displays a message box with treeView.nodes.count, it shows up fine, and everything works as expected. If I attempt to display the same messagebox from the ExecutionComplete subroutine, it also gives the correct number of nodes.

This is where things get a little weird. I have implemented a save feature into my program, so you can save and load data. For some weird reason, if you have loaded the data from a file, rather than adding each node manually, it now returns an empty node collection ONLY if I try to access it from ExecutionComplete. If I try to access the nodes from a button, it still returns the correct values!

What could it possibly be about the ExecutionComplete subroutine that makes it return a value any different than what is returned when the exact same code is placed in a button click event? And why does it only happen when I've loaded the data from a file? I just don't understand how loading it from a file is any different than them adding the nodes manually. The nodes are definitely being added, as I can see them, and the button click event can also see them. Also, ExecutionComplete is obviously able to read the contents of the treeView, because it works just fine if the user has set up the treeView manually.

View 9 Replies

.net - WPF: "Items Collection Must Be Empty Before Using ItemsSource"

Mar 25, 2009

I'm trying to get images to display in a WPF ListView styled like a WrapPanel as described in this old ATC Avalon Team article: How to Create a Custom View. When I try to populate the ListView with a LINQ-to-Entities queried collection of ADO.NET Entity Framework objects I get the following exception:

[Code]...

View 9 Replies

Graphicspath And Line Intersection?

Mar 17, 2010

This is my problem...I have created graphicspaths (gp) in Visual Basic...but every gp has a name. So I want to print every name next to the gp. I use GetBounds to get the nearest rectangle around the gp. But like for a circle the name will be quite far away from the gp. Now I want to draw a line from the name to the outline of the gp...can somebody help me with this little part of script?

View 11 Replies

.net - Array Intersection Function Speed?

Sep 8, 2010

I've written a short function for array intersection and wanted to know why one function is faster than the other.

1)Dim list2() As String 'Assume it has values'Dim list2length As Integer = list2.length

[Code]...

View 3 Replies

.net - Built-in Rectangle Intersection Function?

Mar 31, 2011

Someone once told me VB.net had some built-in function to check if two rectangles intersected. But I cannot find it.

View 1 Replies

Any Way Can Check Intersection Between Any Two OBJECTS Not Just Rectangles?

Feb 11, 2012

I have made considerable progress on a game I am making, but one of the fundamentals of it relies on collision detection. At the moment, I am using Rectangle.IntersectsWith() to check "collision" between two PictureBoxes, but I don't want everything all square (graphics, etc). So I set about adjusting regions and have ended up with a circular button (from the MSDN example). What I'd like to know is this: Is there any way I can check intersection between any two OBJECTS, not just rectangles? As in, if the rectangle intersects with or is inside the circle in any way then how do I check it programmatically?

View 3 Replies

Draw Ishihara-transformations (circles In Circle Without Intersection)?

Apr 28, 2011

Question: I need to draw pictures as below in C#/VB.NET Draw ishihara-transformations (circles in circle without intersection)?

Note that my problem is NOT drawing circles in C#.

My problems is drawing them without much whitespace and without intersection.

My thought would be using "Orbits" and then draw the circles with center on the "orbit" lines. (with some orbit lines for bigger and some only for smaller circles)

View 2 Replies

Find Line Intersection Point With A Grid Of Lines?

Jun 4, 2009

I am suing VB 2008 express edition.

I am trying to solve this problem since many days. The problem seems to be rather mathematical, but I faced difficulties dealing with Grids and how to store them using visual basic.

[URL]

In my problem, I have a world of 200 x 200 units divided into 4 x 4 grids (Each of 50 units).

There is a line crosses some areas has the coordinates of Point A (Starting Point) of (XA = 12.43, BA = 159.48) and Point B coordinates (Ending Point) of (XB = 112.95, YB = 20.95).

The question is, how can find the length of (A to C1), (C1 to C2), (C2 to C3), (C3 to C4), (C4 to C5) and finally (C5 to B)?

In addition, how can I indicate the square in which the line is inside?

note that the method should work for all conditions (-ve and +ve line slopes) and for different A and coordinates.

View 1 Replies

C# - How To File.Exists In Nunit Test

Dec 22, 2010

I have a method which tests for the existence of a file prior to carrying out some manipulation of file content as follows:

[Code]...

The idea is that if the file does not exist, then the file is generated by calls to the NLog logger instance, at which point the file is created and the specified header info is inserted. The method works fine from the application itself, however I have a simple NUnit test which implements a test method to verify that the file is created and populated as expected. When I step through with the debugger, I find that '_logPath' is set to:

D:Documents and SettingsTE602510Local SettingsTemp
unit20ShadowCopyCache4288_634286300896838506Tests_-1937845265assemblydl37cdfe61aaa18c98d_f0a1cb01logs2010-12-22.log

Unfortunately, despite the fact that the file DOES exist, the call to File.Exists returns false. From earlier viewing of the config path the above path would appear to be correct for these NUnit tests. Does anybody have a clue what is happening here and what I need to do to get the desired result? The pathname to the log file as per the XP file system is:D:Documents and SettingsTE602510My Documents_VSSWorkAreaPsalertsIpTestsinDebuglogs

View 2 Replies

C# - Press A Button On A Different Process (nunit.exe)?

Jan 13, 2012

I have recorded this macro that attaches to a process (nunit.exe) for me. Now I'd like to press a button (named "Run") on the window of the process I am attaching to, but how? I have recorded this macro:

Sub DebugNUnit()
DTE.ExecuteCommand("Tools.ExternalCommand6")
'need a short delay for nunit process to appear in process list:
Threading.Thread.Sleep(200)

[Code]...

I am using nunit 2.5.7 and for attaching and debugging to work you need to attach to the nunit agent and press run on the nunit gui, for more recent versions of nunit you can attach to the nunit gui.the above script enables nunit debugging from the Visual Studio IDE with just visual Studio and the nunit binaries. all you need to do is set up nunit as an external tool (with the current project as a parameter), create a custom toolbar, and add a button to that toolbar that uses the above script. this will start nunit, attach to it, start running the tests, and break at your breakpoint.

one more thing: in the nunit gui disable "Save Visual state of each Project" in Tools -> Settings -> Tree Display or the nunit gui will remember the last run test, which is a pain if that's not the one you wanted to debug.

View 1 Replies

Clipboard Access From NUnit-test

Jan 14, 2011

Is there a problem accessing the Windows Clipboard from an NUnit test?I have a VB.NET application which calls System.Windows.Forms.Clipboard.GetText—it works fine in my normal exe, however there is no return value when running with NUnit console (x86).The testfixture itself is marked with RequiresSTA().

View 1 Replies

.net - Grouping Methods In Test Structure Of Nunit Gui

Jan 26, 2011

Currently I have nunit's gui Test Structure setup to use Automatic Namespace suites.I was wondering if it was possible to group up method names inside the TestFixture.At the moment, the tree looks like

[code]...

View 2 Replies

C# - Common Way To Test Complex Functions With NUnit?

Feb 23, 2011

is there a common way to test complex functions with several parameters with NUnit? I think it is very hard or impossible to test every condition.

I'm afraid the combination of parameters that isn't expected in the function is also not expected in the test.

So the expected condition will not fail but the unexpected.

View 5 Replies

Winforms - .net NUnit (2.5) Windows Forms Testing?

Oct 18, 2011

I am retrofitting unit testing into a fairly complex system designed and written by other developers in VB.net. I am trying to develop unit tests for the GUI forms using NUnit and the NUnit Forms extension. (I've been looking at c# examples that are fairly easy to port over if you have a solution but don't know VB syntax as long as it uses NUnit classes)

I will try and explain what I am doing but first a brief description of the program. It basically monitors server activity. You need to connect to a server via a modal form with IP and Port fields(amongst others). Once you have connected to a server other parts of the program unlock and become usable (such as configuration of the server).

Desired process: Load program > click connect button > modal connect form loads > enter details > click OK to connect > main form updates to logged-in state > other functionality

The problem is that I cannot test the functionality of the connect form and then the logged-in functionality of the program. I can test that it loads the modal connect form correctly; enters the details and clicks OK (all fine so-far) but it does not appear to logically progress the program. The modal form just closes again seemingly without running the connect code from the program back-end and I'm back at the main menu not logged in to anything.

I have a feeling that I've either missed something really obvious or that it's simply not doable in NUnit.I have trawled the internet in search of anything similar but the closest was another SO thread that was really generic. Without being able to actually test the logged-in version of the program, I'm at a major hurdle.Another issue is handling message boxes that don't have unique identifiers (e.g. "are you sure you want to exit?"); these also seem to be a major pain in the arse with NUnit (If it makes any difference, I'm running the tests as a stand-alone project using a reference to the executable file of the built project, not the actual source)

View 2 Replies

Winforms - NUnit (2.5) Windows Forms Testing ?

Jun 10, 2012

I am retrofitting unit testing into a fairly complex system designed and written by other developers in VB.net. I am trying to develop unit tests for the GUI forms using NUnit and the NUnit Forms extension. (I've been looking at c# examples that are fairly easy to port over if you have a solution but don't know VB syntax as long as it uses NUnit classes)I will try and explain what I am doing but first a brief description of the program. It basically monitors server activity. You need to connect to a server via a modal form with IP and Port fields(amongst others). Once you have connected to a server other parts of the program unlock and become usable (such as configuration of the server).Desired process: Load program > click connect button > modal connect form loads > enter details > click OK to connect > main form updates to logged-in state > other functionality

The problem is that I cannot test the functionality of the connect form and then the logged-in functionality of the program. I can test that it loads the modal connect form correctly; enters the details and clicks OK (all fine so-far) but it does not appear to logically progress the program. The modal form just closes again seemingly without running the connect code from the program back-end and I'm back at the main menu not logged in to anything. I have a feeling that I've either missed something really obvious or that it's simply not doable in NUnit. I have trawled the internet in search of anything similar but the closest was another SO thread that was really generic. Without being able to actually test the logged-in version of the program, I'm at a major hurdle.Another issue is handling message boxes that don't have unique identifiers (e.g. "are you sure you want to exit?"); these also seem to be a major pain in the arse with NUnit(If it makes any difference, I'm running the tests as a stand-alone project using a reference to the executable file of the built project, not the actual source)

View 1 Replies

Escape Double Quotes In As A Parameter To An NUnit TestCase?

Oct 11, 2011

I tried writing the following TestCase for an NUnit test written in VB.net:

<TestCase("FirstNode", "<node id="FirstNode">")>
Public Sub GetNode_GivenSomeNodeId_ReturnCorrectNode(ByVal nodeId as String,
ByVal expectedXml as String)

[Code]....

The xml-node passed as the second parameter to the testcase is not valid however, as this clearly is not the correct way to escape double quotes. I'm sure I can find a workaround in order to check that the method under test returns the expected XML-node, but I'm curious:

Is there some clever way to pass a string such as this, containing double quotes, as a parameter to an NUnit test?

View 1 Replies

.net - NUnit Tests For Testing Class-level PrincipalPermissionAttribute Demands

Mar 1, 2012

I'm working with .NET 3.5 and Nunit 2.5.10. I'm attempting to write some tests to validate our role-based security enforcement through the PrincipalPermissionAttribute at a class-level. The test appears to succeed (it gets a green checkmark) and the Assert.Throws call properly catches the exception, and all my other assertions about the exception pass. However, once TearDown is complete after a test has run, the exception is re-thrown by NUnit. So even though the test "passed", every one of the tests shows that an exception was unhandled exception was thrown 'while executing' the test run.

I'm guessing I'm doing something wrong, but can't figure it out. My test is:

Public Sub New_TheForm_NoRoles_DeniesAccess()
' attempt to create a new instance of the form, but it should throw an exception with an inner SecurityException
Dim ex As TypeInitializationException = Assert.Throws(Of

[Code]....

Basically, Initialize is normally called in the application with Nothing so that we use the Windows Principal. During unit testing, we instead initialize it with a GenericPrincipal that has no roles, so that we can test that a SecurityException is thrown.

The tests are passing, but NUnit just seems to be re-throwing the exception post-Teardown.

View 2 Replies

.net - NUnit Testing Show A Form And Populate Its Textbox From Dataset In TestClass

May 20, 2011

I have written my and in a test class for vb.net and it works as follows:

A stored procedure is executed and the result is saved in an xml file with the help of a dataset. What I need to do now is , Information of this dataset should also be redirected to a textbox in a form so that I can copy this information in clipboard and create dynamic assert statements for instance I want

datatable.rows.count,
datatable.columns.count,
datatable.columns(i).ColumnName,

and same to get columnType. All of this info would be shown in the form but I am unable to open a form in NUnit test class.

View 2 Replies

.net - Storing Subcollections (filtered Versions Of The Main Collection) Inside The Collection As Cache?

Jan 15, 2010

Is it good practice to store sub-collections of item X inside a parent collection of item X for caching 'filter-queries' which are performed on the parent collection? (They won't be used together (as in color AND type).) Or is it also ok to just Loop over the collection and return the correct entities in a temporary collection?

[Code]...

View 1 Replies

C# - Edit List Collection : Error Note Collection Was Modified - Enumeration Operation May Not Execute?

Sep 7, 2011

I have the following classes:

Product, Service and OrderItem

Product and Service must inherit OrderItem. So basically I want to store OrderItem object in my shopping cart and these object are store in a list.

Public MustInherit Class OrderItem
Private m_enuItemType As TypeOfItem = TypeOfItem.None
Private m_strUserID As Integer[code].....

View 1 Replies

Make A Custom Collection That Take Advantage Of The Collection Editor?

Feb 8, 2010

I have been researching for a couple of days now and to no avail. Does Anyone know how to make a custom collection that take advantage of the collection editor? I would like to be able to have 3 Color Values, 1 Boolean and 1 String.

View 15 Replies

Nunit - Specflow - Getting Specflow To Generate Code In The Output Window

Jul 9, 2010

How to configure specflow to output step definitions in a nunit output window?

View 1 Replies

Difference Between NUnit Testing And Unit Testing In VSTS?

Aug 25, 2009

I use VS team system 2008. At the moment i need to test some business classes, i have found two kinds testing NUnit and the unit testing provided by the VS team system. what are there differences?

View 1 Replies

DataGridView - Convert Nulls To Empty Strings And Display It In The Grid As Empty Strings

May 14, 2009

I have a DataGridView that has some columns with dates. It binds to an in-memory Datatable which gets loaded from an string array of data passed back from the backend Some of the rows returned have nulls for the date columns. Solution 1: If I define the Date column in the DataTable as "string" I can easily convert those nulls to empty strings and display it in the grid as empty strings (desired results). However, if the user clicks on the date column header to sort by date, it doesn't order the rows as you want. You get a purely string sort order. Not acceptable

[Code]...

View 2 Replies

.net - Collection Initializes For Read-only Collection Properties?

Jul 25, 2011

I'm trying to support Basic.NET on my framework so I'm trying to convert C# 4 code to Basic.NET 10. Microsoft is committed to "co-evolve" these two but I'm having a problem with collection initialization... I found that I can initialize a collection much like in C#:

[Code]...

View 6 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved