C# :: Stubbing Page.Form For Unit Tests?

Feb 22, 2011

I can create an ASP.NET Page object in my unit tests by subclassing System.Web.UI.Page.However, I cannot find a way to set Page.Form. Adding a form with attribute (runat,server)does not work. Overloading the form in my Subclass does not give the required functionality.

View 3 Replies


ADVERTISEMENT

Get A Documentation For Unit Tests In VS TS?

Aug 27, 2009

When i perform unit testing on routines, using the unit testing framwork provided by VSTS, i need to get a output of the unit test and result on to a document (documentation). how do i do i do this?

View 1 Replies

Stop Unit Tests From Running?

Jun 11, 2010

I would like to prevent all subsequent unit tests from running when certain conditions are met in a unit test. Is this possible in Visual Studio 2005?

View 2 Replies

.NET Unit Tests - Assert.IsTrue Message?

Feb 18, 2011

I'd like to add a message to be displayed in Visual Studio 2010 test results.I can post a message out if the test fails, but not true. Is there anyway to do this? For example:

dim quoteNumber as string = Sales.CreateQuote(foo)
assert.IsTrue(quoteNumber <> "")

'I would like to make this something like this:

assert.isTrue(quoteNumber <> "", falsepart, "Quote number " & quoteNumber & " created")

View 3 Replies

C# - Unit Tests In Visual Studio 2010

May 26, 2010

i am trying to create a Unit test for a WinForm in a Visual Studio 2010 project. I add a new "Coded UI Test" to my project, open up the code file, then right click and select "Generate Code for Coded UI Test" -> "Use Coded UI Test builder". I then start my application up, select "Record" on the UI Map control. I run my tests (in this case simply select a textbox, type in a random value, them click a button). I then select "Generate Code" from the UI Map control which generates the code which the test will use. When running this test, i get the error:

Test method
HelloWorldTest.CodedUITest1.CodedUITestMethod1
threw exception:

[Code].....

View 1 Replies

.net - Beginning Unit Tests Long After The Project Has Begun?

May 13, 2009

I have taken on a project that has been underway for months. I've yet to ever do unit tests and figured it would be a decent time to start. However, normally unit tests are written as you go and you plan for them when beginning the project. Is it reasonable for me to start now? Are there any decent resources for setting up unit tests without starting a brand new solution (the project is already underway). Using vb.net with VS2005?

View 8 Replies

How To Catch Exception On Page While Running Automated Tests

Jul 8, 2011

I am doing automation testing of a web application using selenium. While running automation testing of web application you encounter application errors. Is there any way to detect those exceptions. Specially exceptions that are on the page which causes the page to hang up as it is not finding the element it is looking for or page stays on the same page and waitforpage() function keeps running.

View 1 Replies

Application Which Communicate With One Data Logger Unit (temperature Monitoring Unit)

Jul 21, 2010

I have written one application which communicate with one data logger unit (temperature monitoring unit) and download records after some interval. Unit continuously send current temperature which I have to show on screen and after each one hour I have to download log (all records saved inside unit at max 1024) from unit.

Now problem is after downloading log, application get hang or what we called working in background and resume after some time. If I pause debugger in visual studio 2008 it show control at application start (sub main) with message as "application will resume here after completing execution of current function". There is nothing in output window. So how can i trace is there any events got spool or what actually application doing in background.

View 1 Replies

Stubbing A Dictionary In Rhino.Mocks

Feb 23, 2012

I have a read-only dictionary on a dependency that I'd like to be able to stub with return values, and check that assignments to it have happened.

I was hoping that Rhino.Mocks would create an empty dictionary for me by default, but unfortunately it doesn't. Since it is read-only, I can't create a new dictionary and assign it to that property.

I was hoping to be able to stub it instead. From what I understand, the C# syntax for this would looking something like this:

m.Stub(x => x.myProperty).Return("abc");

So I was hoping that this would work for VB:

m.Stub(sub(x) x.myProperty).Return("abc");

But it doesn't (compiler error). how to accomplish this? I'm open to the Expect/Verify syntax if it can accomplish this...

View 1 Replies

VS 2008 Unit Converter Handling Multiple Unit Types

Apr 12, 2011

Does anyone have a nice sample of a unit convertor handling multiple unit types that I can integrate in my application? I have found this one, but it is only handling one type of unit. For example I want to convert weight as well as volume from and to imperial units.

View 8 Replies

Save Single Windows Form As Many Page And Reload The Page Whenever Call That Page

May 17, 2012

I need sample vb.net code to save single windows form as many page and reload the page whenever i call that page...

View 1 Replies

Asp.net - Using Javascript On An Aspx Page That Uses A Master Page - Which Contains The Page In A Form?

Aug 7, 2009

I have a master page which contains everything that inherits it within a form. A page inheriting from it needs to run some javascript to act on a text field on a page. However, I can't seem to reference that text field through the javascript, since the form begins on the master page. The following line will come up bogus: document.form1.txtFindUser.value = blah.responseText; This is because form1 is defined on the master page, while txtFindUser is on the current page.

View 3 Replies

Unit Testing - Moq + .NET - Will It Be Fully Supported In VS2010 Automatically In Its Current Form

Mar 11, 2010

We are looking to make a final decision on our Mocking framework. After trying several, I have fallen in love with Moq. I also love TypeMock - but because we are in the early stages of implementing TDD across the team, we do not want to make such a large investment quite yet. We are using VS 2008 now and are going to move to 2010 as soon as it is released.

So after doing much research I have decided on Moq because it's nearly as good as TypeMock and has super clean syntax, etc. Now here's the problem/question: we are mainly a VB.NET shop but are using C# for all of our CRM implementation code (plugsins, etc). It seems Moq only fully supports C# due to VB.NET lacking Lambda sub routines. Can anyone confirm that when VS2010 comes out Moq will work fully with VB.NET in its current version?

Is anyone here using Moq with VB.NET? w/ 2010? We need to make this decision asap, as we are under tight deadline and do not want to change frameworks again (went from NMock to TypeMock and now want to make final decision and move to Moq) or have 2 separate ones per language...

View 1 Replies

Form With A Tab Control That Has 18 Pages - Click On A Tab It Opens The Page And Select A Textbox On That Page

Mar 8, 2009

I have a form with a Tab Control that has 18 pages. When I click on a tab it opens the page and select a textbox on that page (txtTextbox1. Select() ). This works for the first 8 pages but not for the remaining 10 pages. Although on these pages I can mouse click on the textbox, enter info, save then click my Add button that clears the textboxes and has the code (txtTextbox1. Select() ). The textbox is selected just fine. The code for all my pages is the same except for the tab name and the control names. The tab key will move the selection to the next textbox in order on all pages and the Enter key is coded to do the same. The first 8 pages have a total of 256 labels, buttons, list boxes, textboxes and checkboxes on them.

View 10 Replies

Asp.net - IE8 Accelerator Feature Allows Cheating In Our Tests?

Mar 30, 2011

In my company, we make software which we use to test certain skills and intelligence factors of people. Some of those tests are time bound. On the test page, there is an asp control that shows the time remaining. When you right click that control, the javascript that provides the time is interrupted. To solve that, we disabled right-clicking. But now i've noticed that if you do a selection of some text and click the IE8 accelerator blue button, the javascript is also interrupted. Disabling the left-click if of course no option.

I've found an option in IE that disables the accelerator, so for us internally, the issue is solved. But we would like to find another solution, just because we cannot ask every one of our customers to go disable that option on all their computers.

[Code]...

View 4 Replies

TestFixtureSetup Skipped When Debugging Tests?

May 9, 2012

If I try to debug the following code using the Test With -> Debugger option from within VS2010, it falls over on _object.DoSomething() with an Object reference not set to an instance of an object. error. It builds and passes successfully in NUnit.

<TestFixture()>
Public Class Tests
Private _object As SomeClass

[code]....

But should I need to do this or is this skipping of TestFixtureSetup when debugging by design.

View 1 Replies

.net - Constructor-chaining And Null Reference Tests?

Jun 3, 2011

How to test the null value BEFORE calling the other constructor?

' class MyHoyr '
Public Sub New(ByVal myHour As MyHour)
' Can't doing it here !!!! '

[code]....

View 4 Replies

C# :: Does One Still Write Tests With TDD When The Desired Code Has Little To No Logic

Feb 10, 2011

TDD is supposed to have 100% code coverage. Does this mean one is supposed to write tests for property getter and setters, and other methods that contain no real logic, such as dealing with external API functionality? Below is one example method (which happens to also be the example in this other SO question which deals with how best to test it, if we are going to test it). This method doesn't do much. It's a facade of theSystem.ServiceProcess.ServiceController functionality of stopping a service. Currently this code was not being written using TDD, but if it was, would it be something that one should test? There is very little logic here.est to test it (IoC & Adapter Pattern vs. Detouring) please see this other SO question.

Public Function StopService(ByVal serviceName As String, ByVal timeoutMilliseconds As Double) As Boolean Implements IWindowsServicesService.StopService
Try

[code].....

View 3 Replies

Report The Status Of Multiple Tests To The User?

Jul 31, 2009

I want to report the status of multiple tests to the user like this:

Test1 PASS
Test2 PASS
Test3 FAIL

where the PASS should be green and the FAIL should be red. The number of tests is not known at design time, so I can't make N rows of labels and set their properties at run time. If I put all of that text in a single label, is there a way I can turn some of the words green and some of them red?

View 6 Replies

Visual Studio - How To Disable Pinging During Tests

Jun 9, 2012

I have a class that uses My.Computer.Network.Ping to get a boolean value on whether a IP address or hostname is reachable.However, when I'm testing that class, I want to disable pinging so that during the test whenever I run the My.Computer.Network.Ping it will always return false or throw some kind of exception.

I have tried the following, but I still get a true returned (meaning, the attempts to disable ping didn't work)

Dim restricited As New System.Net.NetworkInformation.NetworkInformationPermission(System.Security.Permissions.PermissionState.None)
Dim mySocketPermission1 As New SocketPermission(PermissionState.None)
Dim myWebPermission As New WebPermission(PermissionState.None)
myWebPermission.Demand()'

[Code]...

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

Write Code For Single-answer Multiple Choice Tests?

Nov 28, 2009

I am struggling to write code for single-answer multiple choice tests (i.e. Choices A, B, C, D).

View 11 Replies

VB Form Not Recognized As A Form In Properties - Application Page

May 13, 2011

I want to enable application framework using Form2 as the startup form. The Startup form: combo box lists Form2 when enable application framework is unchecked, but when checked, I get the message that the startup object must be a form, the project then compiles and shows another form as startup. Declarations for Form2 are as follows:

[Code]...

View 6 Replies

Tab Page 1 To Tab Page 2 (textbox1 Input From Tab Page 1 To Textbox2 In Tab Page 2)?

Jun 12, 2011

I have a text input in textbox1 in tab page 1 and i want that text from textbox1 will be displayed in textbox2 in tab page 2.

View 3 Replies

Javascript - Pass Page Or Master Page Object To AJAX Page Method

Oct 5, 2010

I wrote a page Page method in my aspx page. in web service method I need to call FindControl method return textbox and get text box value. But my findControl will take MasterPage object to iterate.

see my code

<script type = "text/javascript">
function ShowCurrentDateTime() {
$.ajax({

[Code]....

How to pass Master Page object or Page to Page method?. So I can use in Sared method.

Is there any way I can access Textbox value directly in Page method? I need access couple of controls in Page Method.

View 3 Replies

Run JavaScript Function On The Page Onload Event In Content Page Of Master Page?

Nov 4, 2010

HOW TO RUN THE JAVASCRIPT FUNCTION ON PAGE ONLOAD EVENT IN CONTENT PAGE OF MASTER PAGE.? means i have masterpage and the content page of master page namely default.aspx in vb.net.i wanna run javascript function in Default.aspx and i have called the function body onload in master page.when i run my website it shows the error "" Microsoft JScript Runtime Error : Object Expected ""

View 4 Replies

Webbrowser Navigate To Page / Wait For Page To Load Then Move To Next Page

Jun 13, 2011

How can I get Webbrowser1 to navigate to each page and wait for the one page to completely load, then move to the next page...? [code]

View 3 Replies

C# - Excel Interop Quitting The Excel Application Instance Makes Tests Fail?

Feb 23, 2011

I want to encapsulate the use of Excel Interop to make it easier to use somehow in a reuseable library.So far, I have written some tests that work good altogether, except that between each test, I force Excel to quite so that it does have handle on the test file no more in order to be able to delete.Once I quit the application instance between after each of my tests, Excel seems to be no longer responding, causing Windows to display "Excel has stopped working and is looking for a solution"

message. This message lasts a few seconds, meanwhile Excel is closing, causing the hang on the file to occur and my tests to throw an exception like "Cannot access file because it is being used by another process..."

[Code]...

View 2 Replies

Session Variable To Change From Page To Page As Move From One Page To Another?

Feb 2, 2010

i am new to this. i have 4 pages. login.aspx, account.aspx, settings.aspx and fliers.aspx.
its all programmed in vb.net with sql server backend.on my firstr page, login.aspx i have this code in the .vb page -

Dim SQL As String = "SELECT * FROM table1 WHERE email='" + Me.txtUserName.Text + "' AND password='" + Me.txtPassword.Text + "' "
ExecuteNonQuery(SQL)

[code]...

View 3 Replies

Why A Page Load Would Be Called Twice On Page When requesting Aspx page

Jul 3, 2006

Does anyone know why a Page_Load would be called twice on a page when requesting an aspx page?I am using .Net 2.0 with the new .net 1.1 compilation model installed. Whenever I request a page, the Page_Load on the aspx page appears to be called twice, so does the Page_Load on and user controls added to that page.

View 16 Replies







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