Architecture :: NUnit - Write One Value To A Database Then Create Another Value?

Aug 17, 2010

Im pretty new to NUnit and am beginning the process of setting up my tests. Some of these test involve a database, specifically checking a particular value against a value in a database and if its not greater than the last retrieved value, flag an error. Whats the best way to test in this scenario ? should I write one value to a database then create another value thats out of sequence and run a database query ? This would involve putting a known value into the table, then running the query with another value.

There is no rollback attribute for nunit, so I gues using TransactionScope would work, that way I could return the database to a known state after the test. There tables have foreign keys so that means adding a lot of extra 'dummy' data first to some of the other tables. Is this sort of 'testing' the best way ? I basically need to perform the test based on an existing data value and I guess this must be pretty standard stuff, so whats the best way ?

As I understand it, the tests should be self contained, so any data i insert into the database during the test should be removed afterwards, is this correct ? If so, it means I need to insert test data into 6 additional tables just to test one function, then remove it after the test has completed, is this the normal way to to this ?

View 2 Replies


Similar Messages:

Architecture :: NUnit Debugging No Longer Working?

Aug 26, 2010

I moved from VS2008 running on XP 32 bit to VS2010 running on Win7 64 bit and just noticed that I can't debug in NUnit like I used to.

On my old system, I just went to Debug|Attach to Process, chose NUnit.exe, and ran my tests from the NUnit GUI. VS2008 would stop at the breakpoints just as normal.

Now when I try this using NUnit 2.5.5.10112 on the new configuraiton it just skips over my breakpoints.

View 1 Replies

Architecture :: NUnit And Public Static Readonly?

Aug 17, 2010

I have an app that I am testing with NUNit. The project im testing has several helper classes that are created as public static readonly. When I run the NUnit tests, they all fail with the same error

Systems.Code.Test.TransactionTest.CreateDataContext_ConnectionString_ReturnsDataContextObject:

View 2 Replies

Architecture :: Reading Values From Config Files In NUnit Tests?

Aug 18, 2010

One of my NUnit tests has to read in some values from config files. In my main application this process works perfectly well, however when I run the unit test, the code that reads in the values from the config files doesnt read anything in. Ive tried putting app.config in my unit test project (I even tried web.config) but nothing seems to work. Are there any special steps involved when reading from config files in an nunit test ?

View 1 Replies

Architecture :: How To Create Ecommerce Site And Database For It

Oct 2, 2010

I want to create small ecommerce site with sign up and log in pages. there are two categories jeans and T- shirt

I want to create category pages and product pages but I dont understand how to form tables in database means exactly how

many tables required for this application and how all tables are connected to each other ( how to make relationship in tables)

when particular user sign in and select particular pages how it will added in his cart.

View 1 Replies

Architecture :: Create A Constants Mapping Of Strings From Database?

Dec 8, 2010

I have a database table that contains list of all UserTypes(constant strings) used in the application.

What is the best way to store(what datastructure do I need) these so that code can access them ?

The need is similar to enum, but I want to associate these values to those in DB so that there will not be 2 places to edit in case of adding/removing an entry.

one other option I considered is using public static readonly string, but how to associate with those values in DB ?

View 3 Replies

Architecture :: Visual Studio And Database Express To Create A Web Site?

Jan 20, 2011

I am using the Visual Studio 2010 Express to create a web site.I created a database using SQL Express,but I decided to copy the mdf file to App_Data folder thinking I then might not need SQL Server running.I used the connection string that points to the database file in App_Data.

I deployed it to the server (Windows 2000 server with .Net 2.0 and SQL Server 2000) using Copy Web Site.I got the following error.An error has occurred while establishing a connection to the server.When connecting to SQL Server 2005,this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.(provider: SQL Network Interfaces,error: 26 - Error Locating Server/Instance Specified)

My questions are

1. Do I still need SQL Server running even if I used a database in App_Data?
2. On the server SQL Server 2000 is running,why does the error say SQL Server 2005?
3. Are there anything that I have to consider beyond the version of Framework when deploying after development with VS 2010 (Framework 4.0)?

View 2 Replies

Verbatim - Why Write @ Before Sql Queries - Select Data From Database Then Write Query?

Oct 1, 2010

Suppose we want to select the data from the database then we write the query for that. Example:

SqlConnection con=new SqlConnection(Connetion name) string selectPkId = @"SELECT PK_ID FROM TABLE" SqlCommand cmd=new SqlCommand(selectPkId ,con);

So,my question is that why we basically use @ before the sql query.If I don't use @ before that then it again work fine (does not give any error), then what is need of using "@"?

View 1 Replies

Architecture :: Create architecture design For WCF Service?

Aug 10, 2010

I am try to create architecture design for WCF service.

We have WCF service that we have to expose to third party so then can request with xml and get back xml response.

The wcf service should do the following:

- Accept the request call with xml

- Check xml against the schema

- Parse the xml

- Authenticate the incoming xml by username and password that will be in xml

- Send back the response

If anybody can let me know what kind of design I can use or is there any pattern available that I can take it and then extend it as per my requirement.

View 2 Replies

How To Write Code Using 3 Tier Architecture

Jan 6, 2010

Presently I am working using single tier architecture. Now I am wanting to learn how to write code using 3 tier architecture.

View 8 Replies

Architecture :: Write An API Library For User Registration?

Feb 10, 2010

My boss asked me to develop an API library for user registration. I am planning to write it in C#, compile it into DLL, and then give DLL to other groups to use it in a web (ASP.Net) application.

View 4 Replies

C# - How To Write A Good Core Architecture For A Project In MVC

Nov 24, 2010

I'm going to have to write a big system in January with ASP.NET MVC3 / C#, and need to know how to write a system that will WORK. I do have a bit of experience with ASP.NET MVC and C# but would not call myself an expert. It needs to be extensible so that I can extend it later with new features. How would one go about this? Is there books that explains this topic in detail or should I use trial and error? In short I need to know good design practice in my code thats extend-able for the future.

View 9 Replies

Architecture :: How To Force An Application To Write Entire Response At Once

Mar 18, 2010

if there is any config setting or any other way to force the response to be written all at once instead of it being written in multiple packets??The problem is I am using a response filter to edit anchor href's and the html parser (HtmlAgilityPack) strips out the malformed HTML when the framework writes to the response stream multiple times, so enforcing an all at once write would solve this headache.

View 1 Replies

Architecture :: Write A Response To Let Users Download A Big File From DB?

Mar 11, 2010

I am a newbie of handling memory.

in my web apps, files are stored as varbinary in sql server.

my goal is to make a response to let users to download the files.

if there is a file (500 MB) stored in one record in the sql server,

what is the best way to let users download it?

I found that , in code-behind, if the files are loaded as byte[] objects, it uses the memory.

for example, the datalength of a file in the database is 500 MB.

the byte[] for this file uses 500 MB memory. am I correct?

how about the filestream? if the file is loaded as a filestream object in code-behind.s

does it also take 500 MB memory?

View 2 Replies

Architecture :: How To Create 3 Tier Architecture

Mar 29, 2011

I was tasked to create 3 tier web application. However, i browsed through many books & tutorials. The examples are doing it using Object data source which my lecturers claimed that it is not 3 tier at all. Shouldn't be dragging any data source into deisgn view. Any comprehensive examples for me to take reference from?

View 4 Replies

Architecture :: How To Create 3-tier Architecture

Sep 16, 2010

structure of 3-tier architrcture

View 7 Replies

SQL Server :: Write Code Of Stored Procedure / Create Stored Procedure And Write Select Statement In It

Nov 23, 2010

how can I create stored procedure and write my select statement in it, I know how to create dataset then put type stored procedure and assign it to the sp ... what I want is writing my sp... how can I make it ?

check the following code, this is what I want to write put I don't know where or how !

CREATE STORED PROCEDURE SP_CATEGORY

@CATEGORY VARCHAR(30)

AS

BEGIN

SELECT LATIN_NAME, ENGLISH_NAME, ARABIC_NAME, CATEGORY

FROM FLORA, CATEGORY_LIST

WHERE FLORA.CATEGORY=CATEGORY_LIST.CATEGORY_NAME AND CATEGORY_LIST.CATEGORY_NAME IN (SELECT * FROM SPLITLIST(@CATEGORY, ','))

END

where can I write this code ?!

View 5 Replies

Architecture :: Binding Of Gridview With Database Versus XML Layer / Database

Apr 13, 2010

I am having serious performances issues with gridview + tabs. Its very slow.. I was thinking to create a XML based logical layer between my database and UI.

1) Will it be useful if i use webservice to get data from database to poppulate gridview?

2) or Use xml + some service (need advice on it)

View 3 Replies

Write / Create Cookies In JavaScript

May 25, 2010

I know how to write/create cookies in JavaScript.

//Create the cookies
document.cookie = "Name=" + Name + ";expires=Friday, 31-Dec-2011 12:00:00 GMT; path=/";
document.cookie = "Surname=" + Surname + ";expires=Friday, 31-Dec-2011 12:00:00 GMT; path=/";
document.cookie = "Number=" + Number + ";expires=Friday, 31-Dec-2011 12:00:00 GMT; path=/";
document.cookie = "Email=" + Email + ";expires=Friday, 31-Dec-2011 12:00:00 GMT; path=/";
document.cookie = "Country=" + Country + ";expires=Friday, 31-Dec-2011 12:00:00 GMT; path=/";
document.cookie = "Company=" + Company + ";expires=Friday, 31-Dec-2011 12:00:00 GMT; path=/";
document.cookie = "Title=" + Job + ";expires=Friday, 31-Dec-2011 12:00:00 GMT; path=/";

But how can I read each one of them in JavaScript because I want to populate the text boxes next time the user come to the form? I have tried this but it does not work:

var cookieName = ReadCookie("Name");
document.getElementById('txtName').value = cookieName;

Edit with Answer:

I used this code.

<script type="text/javascript">
function getCookie(c_name)
{
if (document.cookie.length>0)
{
c_start=document.cookie.indexOf(c_name + "=");
if (c_start!=-1)
{
c_start=c_start + c_name.length+1;
c_end=document.cookie.indexOf(";",c_start);
if (c_end==-1) c_end=document.cookie.length;
return unescape(document.cookie.substring(c_start,c_end));
}
}
return "";
}
function checkCookie()
{
Name = getCookie('Name');
Surname = getCookie('Surname');
Email = getCookie('Email');
Company = getCookie('Company');
Title = getCookie('Title');
if (Email!=null && Email!="")
{
//Populate the text boxes.
document.FormName.txtName.value = Name;
document.FormName.txtSurname.value = Surname;
document.FormName.txtEmail.value = Email;
document.FormName.txtCompany.value = Company;
document.FormName.txtjob.value = Title;
}
}
</script>

And called the checkCookie() function like so from the window.onload

<SCRIPT TYPE='text/javascript' LANGUAGE='JavaScript'><!-- //
window.onload = initPage;
function initPage()
{
checkCookie();
}
//-->

View 3 Replies

JQuery :: Write Code Create Progressbar?

Nov 22, 2010

How to create progressbar in jquery + Asp.net(C#) without adding progress plunging.

View 2 Replies

C# - Create An Outlook Template And Write To Browser?

Apr 1, 2011

how to prepopulate an outlook email's body and subject using the mailto: form of an anchor tag.

What I'd like to see is some examples of Outlook automation code on the server, that creates an Outlook template file (.ost?) and binary writes it to the browser - the browser recognising the extension and firing up outlook with the template.

This is internal and the user will definitely have Outlook.

View 1 Replies

Architecture :: How To Create Wrapper Classes

Nov 24, 2010

I have a third party dll and i need to add some more functionalities (methods, constants etc..) so create a wrapper class. I have no idea about wrapper classes. what is the purpose of this and how to create in .NET for this 3rd party dll.

View 6 Replies

Architecture :: Trying To Create A Project Structure?

Jun 3, 2010

I am using asp.net 3.5 and I am trying to create a project structure (asp.net web solution with UI/Business/Data access) which would be like a base and ready for any new projects in my team and all could use this standard structure only as a base(outer boundary) and they can expand the structure. Also adding on to it I wanted to include certain features like adding libraries of reusable code/functions, so that every team member could use functions from my library within this base structure. To summarize the above, I need to create standard .net project structure/framework/architecture with resusable code library included in it. How can I do this..

View 4 Replies

Architecture :: Create A Plug In For Other Website?

Jul 28, 2010

I have a ASP.net website, i have a page, based on the query string, i grab certain information from database and display the image.

I need create a javascript to put in the javascript in otherwebsite, and then this image will display in that website.

The functionality is same as good ads something like below.

<script type="text/javascript"><!--
google_ad_client = "......";
/* Ad for AdSelector */
google_ad_slot = "....";
google_ad_width = 1;
google_ad_height = 2;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

View 4 Replies

MVC :: Use NUnit As Test Framework?

May 5, 2010

I've just downloaded NUNit and would like it to be an option for my Test Project provider when I create a new MVC 2 application. At the moment the only option I am getting is the Visual Studio (MSTest) option.

View 2 Replies







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