Asp.net - Swapping A Connection String To Access A Test Database For Unit Testing?

Jun 22, 2009

I've set up a test database to begin unit-testing an app that I've recently been added to. It is a 3-tier design (presentation layer, BOL and DAL) and this is my first time writing unit tests. I've decided to start at the BOL and I figure the best way is to swap out the ConnectionString (which has been passed along as a Shared String) with one that points to my new test database. However, I don't wish to change any production code. I simply wish to somehow redirect the app to the test database during unit tests.

View 4 Replies


ADVERTISEMENT

Unit Test And SQL Database Connection

Jun 3, 2009

I am having a problem with a unit test I have created. First time doing this so I am not sure why I am getting this error [code]Test method ETDS_Unit_Tests.LoginTest.ValidateUserNameTest threw exception: System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server).This is the same connection that my software is using, and the software runs fine, only the unit test is failing. What I am doing wrong? It Seems to fail one time for each datarow in the table.Also, I am using a Linq Query in the method that I being tested. I believe that this may be what is causing my error.

View 2 Replies

Getting An Error While Trying To 'Unit Test' Connection-method To Sql Database

Dec 7, 2010

I just bought the MCTS Self-Paced Training Kit (Exam 70-561): Microsoft.NET Framework 3.5 - ADO.NET Application Development, and am trying to do the Lab Exercises now. Allready at the first exercise (point 8), where I am supposed to make an "UNIT TEST",[code]

View 5 Replies

Sql - Unit Testing The Data Access Layer - Testing Update Methods?

May 15, 2009

I'm looking into adding some unit tests for some classes in my data access layer and I'm looking at an update routine that has no return value.It simply updates a row based on the id you provide at whichever column name you provide.Inside of this method, we collect the parameters and pass them to a helper routine which calls the stored procedure to update the table.Is there a recommended approach for how to do unit testing in such a scenario?

View 4 Replies

Unit Test To Have Global Access To Everything?

Mar 24, 2010

Usually when you add one (in Visual Basic), it pops up a message asking if you want to enable an option that lets the test access things like private methods etc.

However, I am editing a solution that does not have this enabled. I'd like to enable it so my unit tests will work, but I can't find the setting.

Can anyone tell me how to enable it after the project has been created?

View 1 Replies

Unit Testing - Use Assert.AreEqual To Evaluate If String Is Greater Than A Certain Length

Feb 1, 2011

I'm wondering how to evaluate an expression using the assert object. The idea is to check if a string is longer then what is minimally acceptable. For example, Assert.AreEqual(stringName.length, >5). I know this method doesn't work but the concept is what I'm trying to get across. Is there a way to test this?

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

.net - Unit Testing C# InternalsVisibleTo() Attribute For NET 2.0 While Testing?

May 13, 2010

I'm building an Active Directory wrapper in VBNET 2.0 (can't use later .NET) in which I have the following:

IUtilisateur
IGroupe
IUniteOrganisation

These interfaces are implemented in internal classes (Friend in VBNET), so that I want to implement a façade in order to instiate each of the interfaces with their internal classes. This will allow the architecture a better flexibility, etc.Now, I want to test these classes (Utilisateur, Groupe, UniteOrganisation) in a different project within the same solution. However, these classes are internal. I would like to be able to instantiate them without going through my façade, but only for these tests, nothing more.

[Code]...

View 1 Replies

.net Connection String For Ms Access Database?

Oct 20, 2011

What is the connection string for connecting MS Access 2010 (.accdb) database in VB.net.

View 3 Replies

C# - Connection String For Ms Access Database?

Sep 3, 2009

My Ms-Access .mdb file is on my website. It is in the App_Data Folder

The current connection string is:

OleDbDataAdapter Da = new OleDbDataAdapter("Select * from SerialNo",
new OleDbConnection(@"provider=microsoft.jet.oledb.4.0;
data source=ftp://ftp.WebsiteName.com/App_Data/SerialNo.mdb"));

Where am I making a mistake in above connection string?

Note: CRs added in the code for better readability

View 2 Replies

Connection String To Access Database

Sep 10, 2011

My query is not the straightforward connection to MS Access.I am using a third application that places all data in an Access database BUT recently they changed the database so that it doesn't end in '.mdb', instead in another suffix: '.accdb'.The database is still an Access database but I cannot connect to it using the connection strings:[code]Previously I was able to use the second connection when the database name ended in '.mdb' (Database Name.mdb).

View 1 Replies

Connection String Of Ms Access Database In Sharepoint

Jun 5, 2011

I will be developing a program using visual studio 2008 with ms access 2007 as my database. What I only use is this type of connection string: "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:mydatabase.mdb;Jet OLEDB:System Database=system.mdw;" but i was asked if it is possible to put the database in sharepoint and I haven't even tried it before. The case is like this, the program that i will do would be installed on some computer units of different branches of the company then the database should be accessible through sharepoint so that every users can access the most updated database.

[Code]...

View 2 Replies

Developing A Unit Testing API?

Dec 29, 2010

I have been assigned a task of exploring unit testing using tools available in the market.My question is how do i write an API that would help in writing unit test cases.Example i can use nunit to write something like this to check whether file exists in the given location.

<Test()> _
Public Sub CheckOutputFileInfo()
ReportPath = "D:temp est.txt"

[code].....

View 3 Replies

Speed Up The Unit Testing?

Aug 29, 2009

In the project that i;m currently working on i;m not allowed to touch GUI for anyreason that includes program testing. I'm in bit of s frustration becuase prior to this all must application were developed and tested using GUI. Typicvally it wold take a me a week to develop an app now it taking more than that. Especially the TDD with Unit testing. The documentation kills more time too......

View 4 Replies

Unit Testing - Experiences Using Moq With .Net?

Apr 28, 2009

I really like the moq mocking framework. I've used it on several projects. Unfortunately, one of my customers is demanding we use VB.Net. Not my preference, but hey, .Net is .Net, right?I've heard that moq has some trouble with VB. Is this true? Is so, what sorts of trouble? I would expect it to work fine given the language agnostic nature of .Net.

Should I look into using some other mocking framework for use with VB?

View 2 Replies

Unit Testing And Could Not Load Dll?

Sep 1, 2011

I have a unit test project and a project A that refers to the dll B. When make changes to the dll B and build my solution again I get an error meassage: could not load dll B or one of it's dependencies when i try to run the test project. The dll B does not exists in the references of the test project.

View 11 Replies

ADODB Connection String For Microsoft Access Database

Jan 17, 2012

I am newbie in Visual studion 2010. May i know how do i setup the connection for a mdb file. Below is my code and i have encountered an error. the error message is "A first chance exception of type '[URL]' occurred in WindowsApplication1.exe".

[Code]...

View 2 Replies

.net - NullReferenceException Unit Testing Error

Sep 18, 2011

Doing some homework on unit testing and in all honestly i just don't get why i get this error.

i got a simple method that select all text when tab and testing if the actually textbox1 is selected. I just don't get why i'm getting a nullReferenceException at target.txtbox1_Enter(sender, e)

Private Sub txtbox1_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtbox1.enter
Dim txtBox As TextBox

[Code].....

View 1 Replies

.net - Unit Testing In Visual Studio?

Apr 1, 2011

I'm wanting to create a load of unit tests to make sure my stored procedures are working, but i'm failing (i'm new to tests in visual studio).Basically I want to do the following:

<testclass()>
Dim myglobalvariable as integer
<testmethod()>

[code]....

The problem is because the tests don't run sequentially, tests 2 and 3 fail because the global variable isn't set.

View 4 Replies

Best Practice Example Of An MVP Implementation Of Unit Testing

May 4, 2009

Can anyone point me towards a complete scenario using MSTest,vb.net, with or without mocks,MVP (supervising controller)

View 1 Replies

Unit Testing - Mocking Methods With Moq

Jul 21, 2009

I am trying to unit test a controller action that uses the membership provider to update user details. I am using Moq which so far has been easy to use. The problem is I can't seem to get it to mock calls to methods that don't return anything.

[Code].....

View 4 Replies

Unit Testing For Invalid Enum Value

Jun 5, 2009

I have a lump of code that looks a bit like this:
If mode = DiaryMode.Admin Then
modeObject = DBNull.Value
ElseIf mode = DiaryMode.Academy Then
modeObject = ApplicationSettings.Academy
ElseIf mode = DiaryMode.Scouting Then
modeObject = ApplicationSettings.Scouting
Else
Throw New NotSupportedException()
End If

The idea of the check is to prep some values for passing into a database call. There are two questions, is the Else worth the effort? The intention is to prevent future extensions of the enum causing the code to return squify results. If the code is valid, I'd like to be able to unit test the behaviour, if it's worth having it's worth testing. How might I go about doing that?

View 3 Replies

Unit Testing In VS2010 Express?

Nov 19, 2010

What are some easy and simple unit testing frameworks to use with Visual Studio 2010 Express vb.net?

Are there any good tutorials geared towards this?

View 2 Replies

.net - Unit Testing Methods With Arrays As Argument?

Jun 16, 2010

I am porting over some C++ assembly to VB that performs demodulation of various waveforms.I decided to go the unit test route instead of building a test app to get a feel for how testing is performed.The original demodulation code accepts an array that is the waveform along with some other arguments. How should one go about performing a test on something that has an array as an argument? Is it acceptable to generate fake data in a file and read it in at the beginning of the test?

On a side note - The original C++ code was written because we were performing math that we couldn't do in VB6 so we had to cross boundaries between C++ and VB6 and arrays were used. Is there a "better" way of handling large amounts of data in the .NET world that us VB6 programmers may not yet be privy to? Or if we aren't crossing that managed/un-managed boundary, should we be representing our data as objects instead?

View 2 Replies

Implement Unit Testing On A Legacy Website?

Jun 24, 2009

I downloaded nUnit and TestDriven.net. I have a legacy Web Site application and I would like to implement some unit testing. I created a class in the app_code folder and added Imports NUnit.Framework etc... After writing a basic test, I get the "Can't execute tests in 'Web Site' application." error. I guess the Web Site project is not supported. Converting to a Web Application is not an option at this time. I have Visual Studio Test Edition, so I tried that route. I created a test project, wrote a couple tests in my test class etc... only to find out I cannot reference the classes in the app_code folder of the Web Site project.

View 2 Replies

Suppress Message Box From Popping Up During Unit Testing

Oct 5, 2011

Was wondering how you do this?As it's very annoying to click "ok" everytime a message box pops up.

View 2 Replies

Unit Testing - Should Each And Every Property Of Entity Be Tested

May 20, 2010

I have been reading some articles on unit testing but I still have some questions.

- What should be tested if we want to test if an entity can be saved or not?
- Should we test each and every property of the entity?
- If I have a solution consisting or 3 projects, will the unit test go become the 4th project?

View 2 Replies

Unit Testing Framework Timeouts In VB 2008?

Feb 19, 2009

I'm running some unit tests for a large VB.Net application I help maintain and am running into problems with tests timing out. The test run is set up so that there's no timeout limit on the overall test run, but a limit of 2 minutes per individual test. However, a couple of the tests take a lot longer than this to run, so we tried adding the timeout attribute to the test's declaration, i.e

<TestMethod(), Timeout(15 * 60 * 1000)> Public Sub DoSomething()

for a 15 minute timeout. However, the 2 minute timeout set in the test run properties seems to be taking precedence, even though it says that the timeout attribute should override it.

View 1 Replies

Unit Testing In 2010 Public Read Only?

Aug 10, 2010

Unit test method that has Public Read Only property, how do I set the public read only property?target.MyReadOnlyProperty = MyObject

View 1 Replies

C# - Unit Testing Using InternalsVisibleToAttribute Requires Compiling With /out:filename.ext?

May 13, 2010

In my most recent question: Unit Testing Best Practice? / C# InternalsVisibleTo() attribute for VBNET 2.0 while testing?, I was asking about InternalsVisibleToAttribute.I have read the documentation on how to use it, and everything is fine and understood. However,I can't instantiate my class Groupe from my Testing project.I want to be able to instantiate my internal class in my wrapper assembly, from my testing assembly.

EDIT #1

Here's the compile-time error I get when I do try to instantiate my type:

Erreur 2 'Carra.Exemples.Blocs.ActiveDirectory.Groupe' n'est pas accessible dans ce contexte, car il est 'Private'. C:OpenProjectsExemplesSrcCarra.Exemples.Blocs.ActiveDirectoryCarra.Exemples.Blocs.ActiveDirectory.TestsGroupeTests.vb 9 18 Carra.Exemples.Blocs.ActiveDirectory.Tests

(This says that my type is not accessible in this context, because it is private.) But it's Friend (internal)

EDIT #2

Here's a piece of code as suggested for the Groupe class implementing the Public interface IGroupe:

#Region "Importations"
Imports System.DirectoryServices
Imports System.Runtime.CompilerServices[code]........

View 3 Replies







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