|
Ok, in the initialization function i'm getting data from database and then i'm setting this data to my controls, so that means I have broken the SRP, even though the purpose of my method is to fill controls with data taken from the database?
I'm doing the same thing with the method PopulateControlsFromItem - firstly i get info from the database and then i'm filling the controls from view with data. I could get rid of this method and place the code in the initialization function, but the code would look messy.
Can you please give me a suggestion of how I should refactor my presenter class?
|
|
|
|
|
razvan_dme wrote: Can you please give me a suggestion of how I should refactor my presenter class?
It's very tough to do as I haven't seen the whole implementation. As "PopulateControlsFromItem" is a part of presenter initialization, testing presenter initialization would cover this method also. Then assert all the expected initializations are happened. AFAIK, you don't write unit tests for each and every method, you write unit tests for testing a particular functionality. Here it is presenter initialization.
Hope it's clear
|
|
|
|
|
Do you happen to know an open source project so that I can see a view of how MVP architecture is handled and tested?
|
|
|
|
|
I have seen StructureMap[^] which is created by Jeremy D Miller. It's a dependency injection framework which helps to create testable applications. Here[^] is a good MVP implementation with steps to test it. It's in ASP.NET.
|
|
|
|
|
If you have a private member that really needs testing, make it internal and use (off the top of my head) [assembly:internalsvisibleto("MyStuff.Tests")]
|
|
|
|
|
how can i change my sql database to mysql database.Is it possible ?
|
|
|
|
|
Migrating from SQL server to MySQL, right ? Try this[^] tool
|
|
|
|
|
|
ali_reza_zareian wrote: how can i change my sql database to mysql database.Is it possible ?
By removing the " " from "my sql"?
|
|
|
|
|
Hi
This is regarding getting tranparency effect for controls in .net compact framewok(3.5).
I want to have few icons diplayed in the form of tiles with their caption below. For the icons image, I am using png files. These icons I am rendering on a transparent panel which is on top of a form. Now I am getting the transparent effect but the border of the png files is not coming as smooth. Some white color border is getting displayed which makes the image look a bit jagged.
I would be highly obliged to you for any help from your side. For any clarifications please revert.
Thanks and regards
Subasish
|
|
|
|
|
Subasish M wrote: but the border of the png files is not coming as smooth
I believe some good image editors like Photoshop, Paint.NET can remove this and make the image transparent.
|
|
|
|
|
No the same image is looking fine in other applications
|
|
|
|
|
I wanna do the transparency panel can you show me how u achieved it thanks
|
|
|
|
|
using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Imaging;
using System.Reflection;
namespace TransparentSmartDevice
{
public partial class TransparentPanel : ScrollableControl, IControlBackground
{
Bitmap background;
public TransparentPanel()
{
background = new Bitmap(
Assembly.GetExecutingAssembly().GetManifestResourceStream(
"TransparentSmartDevice.Test(240 X 374).JPG"));
}
protected override void OnPaint(PaintEventArgs e)
{
//e.Graphics.DrawImage(background, ClientRectangle,new Rectangle(0,0,background.Width,background.Height),GraphicsUnit.Pixel);
e.Graphics.DrawImage(background,0,0);// ClientRectangle, new Rectangle(0, 0, background.Width, background.Height), GraphicsUnit.Pixel);
}
public Image BackgroundImage
{
get { return background; }
}
}
}
using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace TransparentSmartDevice
{
public partial class TransparentPanelBase : ScrollableControl
{
protected bool HasBackground = false;
protected override void OnPaintBackground(PaintEventArgs e)
{
IControlBackground form = Parent as IControlBackground;
if (form == null)
{
base.OnPaintBackground(e);
return;
}
else
{
HasBackground = true;
}
e.Graphics.DrawImage(
form.BackgroundImage,
0,
0,
Bounds,
GraphicsUnit.Pixel);
}
protected override void OnTextChanged(EventArgs e)
{
base.OnTextChanged(e);
Invalidate();
}
protected override void OnParentChanged(EventArgs e)
{
base.OnParentChanged(e);
Invalidate();
}
}
}
|
|
|
|
|
How can I create a transparent label on top on the panel?
|
|
|
|
|
As datepicker control cannot be used in asp.net I wish to use a textbox instead of a calender , but the problem is I want the date to be entered by the clients in the "dd-MMM-yyyy" format. How do I do it?
Any body can help me out of this?
waiting for a quick reply.
Thanks
|
|
|
|
|
Using javascript you can do this. Check the entered input is in the required format (by regular expression or so..). Alert the user if it is not.
You can go for a javascript calendar control. That will be helpful for the end user.
*jaans
|
|
|
|
|
Hello everyone,
Before I start my managed code program (C#), when I execute name2ee command, there is no output, but after the program starts, there is expected output. Any ideas?
(here are the output 2 times and my source code)
0:000> !name2ee *!TestDebugManaged1.Program
0:004> !name2ee *!TestDebugManaged1.Program
Module: 0000064278854000 (mscorlib.dll)
--------------------------------------
Module: 0000064280012e20 (TestDebugManaged1.exe)
Token: 0x0000000002000002
MethodTable: 0000064280013580
EEClass: 00000642801421c0
Name: TestDebugManaged1.Program
namespace TestDebugManaged1
{
class Program
{
public void foo()
{
int a = 100;
while (true)
{
Thread.Sleep(10000);
a++;
}
}
static void Main(string[] args)
{
Program instance = new Program();
instance.foo();
return;
}
}
}
thanks in advance,
George
|
|
|
|
|
what Exactly do you want to return, because your return Statement does not return anything. tell us in Detail
why did you declare
int a = 100;
and if you want to return "a" then you should write a statement
return a;
Hope ths help
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Thanks Vuyiswa,
My expected output is like,
Module: 0000064280012e20 (TestDebugManaged1.exe)
Token: 0x0000000002000002
MethodTable: 0000064280013580
EEClass: 00000642801421c0
Name: TestDebugManaged1.Program
My question is,
why before I press g, and using the same command 0:000> !name2ee *!TestDebugManaged1.Program, there is no output?
regards,
George
|
|
|
|
|
Hi Friendz...
is there any memory size limit for DataReader in .Net? means can it hold any number of records ? (Above 1crore records)
Any idea?
Thanks in Advance
Shah_tech
|
|
|
|
|
here is an example of Odbc Data reader
u read each row at a time until the value of Reaq() is false - no more rows to read
u can not read all rows at once
OdbcDataReader Reader;
while (Reader.Read())
{
object[] dataArray = { };
Reader.GetValues(dataArray);
}
u can use : dataSet to hold data and use datadaptor to fill the dataset
this method is more handy where u assign an SQL stat. to the adaptor and by using the Fill
method u read all rows to the datatable inside the data set
Have Fun
Never forget it
|
|
|
|
|
DataReader won't hold the rows. It's a connection oriented design and it reads row by row. So if you are reading 1 crore rows, connection has to be open for until it finishes.
|
|
|
|
|
Hi All,
I'm using SQLBulkCopy class in .net 2.0
I'm passing SQLDataReader object to SQLBulkCopy's WriteToServer () method.
Actually, source query returns around 1crore records. while running this exe I'm getting System.OutOfMemoryException exception.
any ideas to handle this exception?
Thanks in Advance
Shah_tech
|
|
|
|
|
According to wiki a "crore" is 10million in India or 500000 in Iran(you learn something everyday ), since you are from india i will assume it is 10 million.
10 million records is a huge amount of data, you should fragment this process to deal with a far smaller chunk at a time or buy more RAM.
modified on Friday, July 11, 2008 2:18 AM
|
|
|
|