This project has moved and is read-only. For the latest updates, please go here.

Testing and XtraNavBarWorkspace.Close() bug

Jan 19, 2008 at 9:48 AM
Edited Jan 20, 2008 at 12:08 AM
The tests are turning out to be quite useful.
I was testing the XtraNavBarWorkspace.Close() method today and it didn't work.
Most of us probably don't need this method anyway, but there was a bug in it. The TODO explains the problem (see code snippet below):

The solution was to check for > -1 not > 0. Now it works.
 // TODO : Check why group not removeable
if (Groups.IndexOf(group) > 0)
    // get rid of the navbar group

I think this came about because of some confusion about catering for design time and not removing the 'first' control, but I can't see any reason why the test below shouldn't pass.

I'm not a slave to the one-assert-per-test theory, as you can see.
public void CanShowAndCloseAndHideXtraNavBarWorkspace()
	XtraNavBarWorkspace navbarWorkspace= new XtraNavBarWorkspace();
	XtraNavBarGroupSmartPartInfo smartPartInfo = new XtraNavBarGroupSmartPartInfo();
	smartPartInfo.Title = "Test Title";
	Assert.Equal(0, navbarWorkspace.Groups.Count);
	// show the workspace
	navbarWorkspace.Show(_smartPart, smartPartInfo);
	Assert.Equal(1, navbarWorkspace.Groups.Count);
	Assert.Equal(NavBarGroupStyle.ControlContainer, navbarWorkspace.Groups[0].GroupStyle);
	// hide and the group still exists, but not visible
	Assert.Equal(1, navbarWorkspace.Groups.Count);
	// close removes
	Assert.Equal(0, navbarWorkspace.Groups.Count);