|
Member 8674492 wrote: I'm wondering if I should use my real Data Access Layer in my tests
Yes, you should
|
|
|
|
|
For acceptance testing? Yes. That should be as close to the actual production environment as possible – if you can do it, it should actually be on the production environment.
However, you should of course also have automated unit and isolated integration tests that use a mocked out DAL which you run as a matter of course during development.
|
|
|
|
|
Most decent mocking toolkits will allow you to simulate return values from code, so you could call your DAL code and set it up to ignore certain calls and then return you carefully crafted data to satisfy your test criteria.
|
|
|
|
|
Please help me to do a program that can download a file from a ftpserver with a progress bar that computes the percentage of the downloaded data. But it is by using the asynchronous method that was written from the codefile.cs and that will be called on th form.cs.The progress bar is in the other form.t.y
|
|
|
|
|
Perhaps you and this guy[^] could get together. I find it suspicious that you both have the same requirements.
As your account is new, it could be that you are unaware of the way the forums operate. We help you solve issues that you have with code that you've written - we don't write it for you.
|
|
|
|
|
Member 9454563 wrote: Please help me to do a program
I only do humans.
Member 9454563 wrote: that can download a file from a ftpserver with a progress bar that computes the percentage of the downloaded data. But it is by using the asynchronous method that was written from the codefile.cs and that will be called on th form.cs.The progress bar is in the other form
What do you need help with exactly? Finding the manual? Well, here[^] it is, and even contains samples. Anything else you need help with?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Guys I need your help! Please help me to make Asynchronous method of uploading and downloading FTP with progress bar in C#.
|
|
|
|
|
rikah wrote: Please help me to make Asynchronous method of uploading and downloading FTP with progress bar in C#.
Asynchrone methods calls? Take a look here[^]
I would do it as a thread[^] and use delegates [^]to update the progress bar.
------------------------------
Author of Primary ROleplaying SysTem
How do I take my coffee? Black as midnight on a moonless night.
War doesn't determine who's right. War determines who's left.
|
|
|
|
|
We'll be happy to help. First, please let us know what you've tried and where you're having problems.
/ravi
|
|
|
|
|
On the windows form, we put listbox for the list of directories. A button to get the list of directories and display it on the listbox. Another button for downloading, and another button for uploading. We just need Asynchronous method when downloading or uploading a file or getting the list of directories.
|
|
|
|
|
Hi
I have a small project that would require me to convert a ASP Classic with 5000+ lines of code to ASP .NET C# is there such a tool that can do this for me? I've already research for the whole week but all the tools that I've tried didn't work. should I do a rewrite for the whole thing?
Thanks in advance.
|
|
|
|
|
I don't believe there is any tool that can do a full conversion for you.
There are a few that can help you convert parts of the program but honestly, you will have to do a large amount of conversion on your own.
|
|
|
|
|
Since ASP and ASP.NET are so vastly different, there is no conversion tool to go between the to. You have to rewrite this by hand.
|
|
|
|
|
I think the closest model to use is the Razor Web pages. If you try to use web forms or MVC, the change will be too much. Read about Razor web pages to learn about it.
|
|
|
|
|
Hi Guys,
I have a program that reads stuff from a Searial COM port. It uses one of those USB to COM port gizmos (Prolific driver).
The environment is Win7/Server 2008R2 (all 64 bit), joined to domain, .NET4.
The program works fine when run from within context of an end user.
However, when i try to run the same program as a windows service I get 'The system cannot find the file specified'. I tried to configure the service to run both as a local system account and as a domain service account (added to the admin ug), but still the same error.
I also created a little test program (see the code at the end of the post, it is stolen from somewhere on the internet).
This runs fine when run from the console and opens the port and reports its type (CHAR), but fails with the same error (File not found) when i try to run it as a scheduled job.
Again i tried running it both under my own account and under account of a service (both added as local admins) and it is the same error.
I am pretty sure it is some sort of a security/policy issue but cannot quite figure out what.
Any pointers will be greatly appreciated,
Alexei
static void Main(string[] args)
{
var portName = @"\\.\COM3";
var handle = CreateFile(portName, 0, 0, IntPtr.Zero, 3, 0x80, IntPtr.Zero);
if (handle == (IntPtr)(-1))
{
Console.WriteLine("Could not open " + portName + ": "
+ new Win32Exception().Message);
return;
}
var type = GetFileType(handle);
Console.WriteLine("File " + portName + " reports its type as: " + type);
}
[DllImport("kernel32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall,
SetLastError = true)]
public static extern IntPtr CreateFile(
string lpFileName,
uint dwDesiredAccess,
uint dwShareMode,
IntPtr SecurityAttributes,
uint dwCreationDisposition,
uint dwFlagsAndAttributes,
IntPtr hTemplateFile);
[DllImport("kernel32.dll")]
static extern FileType GetFileType(IntPtr hFile);
enum FileType : uint
{
UNKNOWN = 0x0000,
DISK = 0x0001,
CHAR = 0x0002,
PIPE = 0x0003,
REMOTE = 0x8000,
}
|
|
|
|
|
Did you try configuring your service to run as a network account?
Why are you using CreateFile anyway? Can't you just open Com3 using the serial port class?
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
No, I have not run it under network service account. I run it under local system account, which should have unrestricted access anyway.
CreateFile -- it is just a test program that illustrates the problem. The real service uses SerialPort class and behaves the same.
|
|
|
|
|
abshmak wrote: unrestricted access anyway
But not to network resources.
abshmak wrote: SerialPort class and behaves the same.
The serial port class give you a "File not found exception" also?
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
Wes Aday wrote: The serial port class give you a "File not found exception" also?
Yep, when run as a service or a scheduled task under an account that has local admin access.
Thanks
|
|
|
|
|
There are some strange differences between an interactive session and a service with the same user account. Last week, I had to find out that the environment variable %appdata% need not get resolved for the service.
Also look for batch files which are executed when a user logs in interactively.
|
|
|
|
|
Yep, i know. it is a non interactive service and has all the settings configured properly. It would be coming with a diff error anyway.
|
|
|
|
|
I see a problem. In the second parameter to CreateFile, you're not specifying any access rights.
You're supposed to request
GENERIC_READ | GENERIC_WRITE
Or in numbers:
0x80000000L | 0x40000000L
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I was going to try it, even though i did not think it would be an issue, as it should have behaved the same regardless of the account/mode it is run under. But then uncovered the solution.
|
|
|
|
|
Hi Guys,
I found the solution to my particlar issue, so posting it here in case it might help someone one day.
I am using an RS232 to USB cable. Supposedly it uses Prolific chipset.
Originally i installed the drivers supplied by the manufacturer. While trying to troubleshoot i installed the oficial prolific drivers which did not work, so i had to revert back to the initial drivers.
But, once this has been done, the things started to work:
- i no longer needed to run the program as elevated
- when run as a service the program is able to access the port
I suspect that this is some sort of a fault in the install package provided by the manufacturer, but i am going to leave it at that.
Regards,
Alexei
|
|
|
|
|
I am writing a C# 2010 console application that will have between 10 to 30 ways on how to run the application. The ways to run the application depends upon the parameter values that are supplied to the application. There a few ways to run the console application were the steps need to be completed successfully before the next step is executed.
I am trying to determine the best way to setup this application. Should I have the program determine how it should run by:
1. passing values to console application that will be run in the main method?
2. Should I use a database table that will be read to determine the way the program shoulld be executed on a particular run?
3. Is there an option using a windows service and/or scheduler?
4. Do you have any other options that will work?
Basically can you tell me what method you think would be the best and why? In adition can you tell me and/or point me to a reference that I can use to code your method of choice?
|
|
|
|