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
Similar Messages:
Sep 8, 2010
But I have other tests that are essentially deployment tests (you can't test how the production deployment went using a unit test on a build server) and I'd like to use the nUnit framework to run these.But, the production server doesn't have the nUnit command line executer. I'm only allowed to run aspx pages and reference .dll's in bin.What do I need to do to run tests (yeah, yeah, they're not really unit tests--relax) using nUnit in a webpage? Is there a straight forward way to do this, or does this essentially require porting the nUnit winforms test runner to ASP.NET?
View 1 Replies
Oct 28, 2010
Say I have 3 keys:
<add key="w1" value="1"/>
<add key="w2" value="2"/>
<add key="w3" value="2"/>
I want to create a randomizer so that it gets random values each time.
View 1 Replies
Jul 25, 2010
my subprojects creates serveral web.config files? I have solution that consists of 10 projects and I want everyone to compalie but the one in the top root. Now my problem is that my subprojects are all located inside folders in the root and my subprojects generates each a web.config. Thhis doesnät work very good so what should I reconfigure would you say?
View 2 Replies
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
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
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
Oct 21, 2010
In my project we use UnitTests (MsTest). We run them manually and in the build script.But for some environments where we deploy manually.We are in the need of having some smoke tests. At the moment I made this smoke tests "manually" (Login, create an user, create a licence, create a product, etc). I know I can run unit tests from command line or from visual studio but...Do you know if is possible to run these mstests (or probably a small subset) from an .aspx page and show the results?EDITED: wondering if mstests or something is able to run the tests and have something visual to show in an .aspx page similar to a list of tests passed and tests failed...I am thinking on running only a small subset of tests (5-6)
View 1 Replies
Feb 16, 2011
Currently, I work on an ASP.NET project which is hosted under version control and is used on several developer machines, tester machine and production environment.
In three cases, configuration (Web.config) may be different. For example, developer and tester environments use testing SQL Server, whereas in production environment, another SQL Server is accessed, so the connection string is different in those cases.
We want to keep three versions of Web.config in subversion. But modifying each of three files every time we need to add, remove or change a common setting is annoying: it would be nice to have a common, master Web.config, which will be inherited by each of the three Web.config files.
How to set up an ASP.NET project which will use a master configuration file and different slave configuration files on different machines, thus sharing the same project/source code/configuration files in subversion?
View 2 Replies
Sep 1, 2010
We are experiencing some strange behaviour on one of our ASP.NET web servers (Windows 2003 64-bit). After some activity, two third-party controls are unable to run correctly. One is log4net (it does not write error messages out) and the other is a menu control (it displays eval message instead of picking up its license). The one common thread is that both controls pick up their config from external config files (linked to from web.config).
Just wondering if anyone has any thoughts on this or experienced this in any way. Is it related to file/folder rights? The server has been running fine for a while and just started exhibiting this behaviour. Perhaps it occurs around the time the worker processes are recycled.
View 1 Replies
Feb 17, 2011
The below is the custom config files
<Test>
<testA att1="A" att2="B" att3="C"/>
<testB att1="A" att2="B" att3="C"/>
</Test>
If I send testA then the class will return all testA attributes i.e att1, att2 and att3 values.
testA, testB will vary.. that means in future we will add another two tags i.e testC, testD and so on.
My application will be returned all the attributes based on my inout (testA...).
View 2 Replies
Jul 1, 2010
I was following the tutorials from this two sites:
http://www.15seconds.com/issue/070104.htm
http://aspnet.4guysfromrolla.com/articles/020404-1.aspx
Following the first site, it had worked but when I´ve moved the pages and files to other folders and set the web.config file on this folder, now it won´t work at all!!!
The file is an *.swf object. I did put the asapi.dll to map the extension on the website root, I´ve put the
[Code]....
on the web.config new folder and on the web.config website´s root.
It won´t work!!! I can access the file directly!!! on the web.config of the folder that contains the file, there is a <deny users="*" /> line.
View 4 Replies
Nov 15, 2010
I would like to put a value in web.config file in my project and read it programatically from .aspx page.Under which section of web.config file should I save the value. This is not a connectionstring. It is path of a file. And I how can programmatically read the value in the code?I am using C#.
View 3 Replies
Feb 9, 2010
My asp.net app has is using a web.config for common configuration. I also have a section that maps some data objects to connection strings, and that section is going to be couple thousand of lines. I want to move that section to another config file "dataMappings.config", so I don't bulk up web.config - is there a standard mechanism of accessing that config file?
View 1 Replies
Oct 21, 2010
Is there a reason why i get different result when reading collections using WebConfigurationManager.GetSection method.
It sometimes returns values correctly in the Hashtable and at other times returns nothing for the same data. Its inconsistent.
client:-
Hashtable hsh = (Hashtable)WebConfigurationManager.GetSection("test1");
Config:-
<section
name="test1"
type="System.Configuration.DictionarySectionHandler"
/>
<section
name="test2"
type="System.Configuration.DictionarySectionHandler"
/>.......
View 1 Replies
Jul 8, 2010
I a custom config file which I am having problems reading from a class project, is there a simple way to do this? the path does not seem to be getting picked up in code, where as this works in a web project
View 2 Replies
May 7, 2010
I just upgraded to VS 2010 and MVC 2.0 and I noticed the web.config has two additional files attached to it? Are these files used to specify debug and release specific settings, so you don't clutter up the main web.config?
Does it even make sense to place a connection string in the root web.config file if I have have a local and remote one in the debug and release web.configs respectively.
View 1 Replies
Apr 11, 2010
I am processing some CSV file which i have copied in Bin folder of My ASP.NET Website.
When i execute
using (IDataReader csv = new CsvReader
(new StreamReader("sample.txt"), true, '|'))
{
.....
}
it complains me that "sample.txt" not found in "c:Program Files....."Won't the runtime automatically look into the bin folder?what modification do i need to do?
View 1 Replies
Mar 16, 2011
I have a .txt file and i open this file, read it and encrypt and decrypt it, it works fine. Now i want to read all types of files like .png, .pdf, .doc etc and do encryption /decryption. file.readtoend() does not work here. How can i do tht?
View 1 Replies
Nov 2, 2010
I have a website written in C# that was running fine on one server. We moved it to another server and have a couple issues. I am mainly a VB.NET coder but can do a few things in C#. This is not a project - it is a website and can open it in VS2008 no problem. This is an admin site for the whole website where the user can add customer comments, etc. When logging in, it works fine. I can go to one of the admin pages after logging in and works. If I go to two other different pages, I get this error:
Object reference not set to an instance of an object.
[Code]....
It turns out this is in the main.master page and it is used by the other pages that load fine. The ApplicationTitle variable is set right in the web.config file and like I said, it shows on the other pages.
My question is why would this code work fine for some pages and not two others? All of these admin pages are under a folder called Admin and the web.config file is in the root folder of the website. Its almost like these two pages cannot see the web.config file in the root folder? Why would that be if thats the case?
Btw, when I have this loaded in VS2008 and try to do a Build, it says:
It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.
I would assume the folders on the server are set right since all but two .aspx pages run fine. Just something I thought I would mention. This does not really seem to be a coding issue but something not set right especially since it ran on the other server just fine.
View 9 Replies
Jan 5, 2011
I have some inherited code which stores SMTP server, username, password in the system.net/mailSettings/smtp section of the Web.config.
It used to read them like so:
Configuration c = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);
MailSettingsSectionGroup settings = (MailSettingsSectionGroup)c.GetSectionGroup("system.net/mailSettings");
return settings.Smtp.Network.Host;
But this was failing when I had to deploy to a medium trust environment. So following the answer from this question, I rewrote it to use GetSection() like so:
SmtpSection settings = (SmtpSection)ConfigurationManager.GetSection("system.net/mailSettings/smtp"); return settings.Network.Host;
But it's still giving me a SecurityException on Medium trust, with the following message:
[Code].....
View 1 Replies
Mar 4, 2011
I have write small web-service that recieves query and read txt file for matching. For it I'm using StreamReader.
I'm not waiting that it will be thousands of users in hour for this service, but whats worried me - if some users at the same time will be use that service is it ok? Can text file on server side be readed at same time from some users?
What is capacity for using StreamReader or StreamWriter on server?
View 6 Replies
Mar 4, 2011
Want to create a web based application for reading and writing excel files.
Issue :
1. Want to upload an excel file and store it some location.
2. Read data from excel file, performing some sorting and filtering
3. Write filtered data to new excel file.
View 1 Replies
May 10, 2010
I'm able to upload and read any excel file to my server prior 2007, when I try an 07 Excel file, i'm getting the following error message:
'microsoft.ace.oledb.12.0' provider is not registered on the local machine'
do I need anything specail on the web server to allow for Excel 07 files? I'm running IIS6 and a Win 2003 server
View 1 Replies
Mar 16, 2010
iam Working on Asp.net Web apliation using c#.net, in system folder (Ex: E://Santhu) i have few Flat files and Excels Files .So My Application should read those files automatically and should store the data into my database..
View 1 Replies