|
|
Hi,
if you hope to get
MMMMMyyyyy NNNNNaaaaammmmmeeeee iiiiisssss BBBBBrrrrruuuuuzzzzzeeeee
then your code isn't the right one. The Console class is somehow synchronized in an effort to
keep the output readable, so each Console.WriteLine will execute in sequence; the sequence of
the threads will however be random, but since they all emit the same text, you won't notice.
|
|
|
|
|
I have a presenter(int a MVP architecture). The initialization function gets some data from the database. First I populate the comboboxes and then i populate each control with data
IList<payments> payments = _dbOp.GetListOfItems<payments>();
_view.SetCbPaidtoAccount_DataSource(paidToItems, "Text", "PaymentId");
etc...
OrderItem orderItem =_dbOp.GetItem<orderitem>(orderId)
if(item!=null)
PopulateControlsFromItem(orderItem);
</orderitem></payments></payments>
private void PopulateControlsFromItem(orderItem)
{
_view.SetPaymentType_Value=orderItem.paimentId;
etc...
}
My question is.. how would you test the PopulateControlsFromItem method?
|
|
|
|
|
razvan_dme wrote: how would you test the PopulateControlsFromItem method?
It is a private method and you are wondering how to test it, right ? Looks like you have a design issue. Look at the SRP[^] and refactor your class which will make it test friendly.
If you think it is in a good structure, try mocking _dbOp.GetListOfItems() and other codes and test presenter initialization. But it's not a good approach though.
|
|
|
|
|
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
|
|
|
|