I am trying to develop unit tests for the presentation layer of the Model View Presenter. My problem is that I cannot instantiate an instance of my view from the presenter without going through the my .ascx.cs file. IView view = null; // TODO: Initialize to an appropriate value
How do I initialize this to an appropriate value when I actually get all my values from session info which I cannot access from the presentation layer.
Can someone help point me in the right direction. I have found numerous examples using mocks, but nothing for the unit testing suite included with the IDE.
After several hours of trying to find a solution yesterday that's about the only option I could find. Unfortunately I've never used mocks before. I guess this will, with the permission of the project lead who thinks I should hardcode everything I need to test, provide me with the opportunity to learn.
I think the problem is that when your working with an ajax page- the top level gives readystate complete that all frames are fully downloaded - but when your working with an AJAX page the scripts are still running and running off to get their data.
It's not looking likely that there's a simple way to detect when the page is completely loaded =(.
I have figured out how to export data from C# to an Excel sheet by opening one specific excel file that I have already created. I want multiple applications to write to the SAME excel file. So the first application would open and start editing the excel file. When the second application starts running, I don't want to open Another READ-ONLY version of the excel file. Instead, I want to simply have the second application edit the same file. Is this possible?
Once again - No. It cannot be done using an Excel object.
Excel does not have the ability to merge changes from multiple sources at the same time. If you got multiple instances to open the same workbook, then both apps made different changes to the workbook, the last one to save it's changes wins, completely overwriting everything else that was changed in previous saves by the other copies of the app.
So, if Instance1 opened the workbook and Instance2 open the same workbook, both instances would have their own copy of the data. Now, if Instance1 changed cell A1 and Instance2 changes cell B1, then they both saved, but Instance2 saved last, the only change you'd see in the workbook would be that to cell B1. Cell A1 wouldn't have changed from the original workbook.
Use a real database engine and if you need that data in an Excel sheet, have a tool that exports the data into a workbook so you have a point-in-time copy of the data in Excel.
Dave Kreskowiak Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
i want to update my application with a prompt for that.
i found Clickonce is very good, and tried alot to understand,
see could able to publish and make the new versions,
but my requirement is whenver user opens my applicaions and connected to internet i need to promt him saying u r working with olderversio(1.0 and current version 3.0 is available)
if user clicks ok it should be updated please
help me how to do so
thnx in advance
This info must be available in lots of places, but here it goes (in short)...
To publish the initial application:
1. Right click on the Project in solution explorer. Click Properties. Click the Publish tab.
2. Enter the location you want to publish to in 'Publishing location'
3. Click the 'Updates' button.
4. Check the 'Application should check for updates' checkbox.
5. Check the 'Before the application starts' radio button.
6. Click OK to close the dialog.
7. Back on the main screen, select 'The application is available offline as well'
8. Enter your initial publish version under 'Publish Version'
9. Click the 'Publish Now' button.
To publish an update:
If you want to publish an optional update, just increment the 'Publish Version' and click the 'Publish Now' button. When starting the application the user will be prompted if the update should be installed. The user has the option to skip the update.
If you want to publish a required update, increment the 'Publish Version'; then, click the 'Updates' button. In the dialog, check the 'Specify a minimum required version for...' checkbox. Enter the same version you just entered in 'Publish Version'. Click OK to close the
dialog. On the main screen, click the 'Publish Now' button. The update will automatically install as soon as the user starts the application.
appDeploy.CheckForUpdateProgressChanged += new DeploymentProgressChangedEventHandler(appDeploy_CheckForUpdateProgressChanged);
appDeploy.CheckForUpdateCompleted += new CheckForUpdateCompletedEventHandler(appDeploy_CheckForUpdateCompleted);
appDeploy.UpdateProgressChanged += new DeploymentProgressChangedEventHandler(appDeploy_UpdateProgressChanged);
appDeploy.UpdateCompleted += new AsyncCompletedEventHandler(appDeploy_UpdateCompleted);
yes i am sure, i've selected 'The application is available offline as well'
and can u please help me , how to work with Deployment.[ApplicationDeployment appDeploy = ApplicationDeployment.CurrentDeployment;]
i couldn't create instance to ApplicationDeployment ,
please tell me whatz all the credentials needed to create an instance to ApplicationDeployment .
thnx in advance
The ApplicationDeployment class does not have a constructor, so you can't create an instance of it. The only way to get an instance is to use the static CurrentDeployment property.
No offense, but I do suggest you start looking at the documentation rather than asking basic questions like this on the forum. The forum really is meant to get answers to things you can't readily figure out from the documentation.
The entire .NET framework documentation is available online. See for example:
I have to tables that I have joined together in sqlserver and I am trying to pull columns from both. However, myReader only picks up the first table's columns and i cannot retrieve any columns from the second table. How do I retrieve columns from multiple tables? Here's what I've got. Also is there just a way to type in the column names when retrieving data as opposed to specifying the column id. All suggestions welcome. thanks.
Yeah, it's possible to bring back the data by name but not the way you are doing it unfortunately. Not sure why MS do things this way but if you use:
agencyphone = myReader["YourFieldName"].ToString(); it should work (it's fine for strings but a pain for other datatypes)
I'm not sure why you only get one table's worth of fields back in the query, what does it do when run in query analyser /SQL Management Studio?
Depending on how many rows you have in each table and the width of the table it is often worth using DataRelations in a dataset to join on the client side, this can reduce the weight of data that you pull down the wire consderably.