Click here to Skip to main content
15,886,110 members
Home / Discussions / C#
   

C#

 
AnswerRe: Editor, Visualization, C# Pin
#realJSOP1-Apr-20 4:51
mve#realJSOP1-Apr-20 4:51 
GeneralRe: Editor, Visualization, C# Pin
Calin Negru1-Apr-20 5:15
Calin Negru1-Apr-20 5:15 
GeneralRe: Editor, Visualization, C# Pin
Dave Kreskowiak1-Apr-20 5:29
mveDave Kreskowiak1-Apr-20 5:29 
AnswerRe: Editor, Visualization, C# Pin
Richard MacCutchan1-Apr-20 22:18
mveRichard MacCutchan1-Apr-20 22:18 
GeneralRe: Editor, Visualization, C# Pin
Calin Negru1-Apr-20 22:49
Calin Negru1-Apr-20 22:49 
QuestionEuropean Car plate recognition Pin
Member 1478897131-Mar-20 22:20
Member 1478897131-Mar-20 22:20 
AnswerRe: European Car plate recognition Pin
OriginalGriff31-Mar-20 22:42
mveOriginalGriff31-Mar-20 22:42 
QuestionMemory Management in Unit Testing Pin
User-862169531-Mar-20 19:20
User-862169531-Mar-20 19:20 
Hi Dear,
I was writing on unit test using Nunit, and suddenly one question came in my mind. So my Unit test are beloe:

C#
[TestMethod]
public void TestMethod()
{
string input ="1,2";
int output =3;
Add add= new Add();
var result= add.GetSum(input);
Assert.AreEqual(output, result);
}


Now my query is when we are defining any variable using string or int it will allocate some memory in heap or stack. So will that memory get de-allocated after completion of unit test?

OR What if will not define variables and pass values directly in Assert like below:

C#
[TestMethod]
public void TestMethod()
{

Add add= new Add();
var result= add.GetSum("1,2");
Assert.AreEqual(3, result);
}



So what is the difference between both the unit tests in terms of performance and memory management?

Thanks
AnswerRe: Memory Management in Unit Testing Pin
Richard MacCutchan31-Mar-20 21:04
mveRichard MacCutchan31-Mar-20 21:04 
AnswerRe: Memory Management in Unit Testing Pin
Pete O'Hanlon1-Apr-20 0:24
mvePete O'Hanlon1-Apr-20 0:24 
AnswerRe: Memory Management in Unit Testing Pin
F-ES Sitecore1-Apr-20 1:38
professionalF-ES Sitecore1-Apr-20 1:38 
QuestionReference Types v. Value Types Pin
Richard Andrew x6431-Mar-20 10:52
professionalRichard Andrew x6431-Mar-20 10:52 
AnswerRe: Reference Types v. Value Types Pin
OriginalGriff31-Mar-20 11:42
mveOriginalGriff31-Mar-20 11:42 
AnswerRe: Reference Types v. Value Types Pin
BillWoodruff31-Mar-20 12:31
professionalBillWoodruff31-Mar-20 12:31 
GeneralRe: Reference Types v. Value Types Pin
Richard Andrew x6431-Mar-20 13:38
professionalRichard Andrew x6431-Mar-20 13:38 
GeneralRe: Reference Types v. Value Types Pin
BillWoodruff31-Mar-20 18:38
professionalBillWoodruff31-Mar-20 18:38 
AnswerRe: Reference Types v. Value Types Pin
F-ES Sitecore1-Apr-20 1:19
professionalF-ES Sitecore1-Apr-20 1:19 
GeneralRe: Reference Types v. Value Types Pin
Richard Deeming1-Apr-20 2:20
mveRichard Deeming1-Apr-20 2:20 
GeneralRe: Reference Types v. Value Types Pin
F-ES Sitecore1-Apr-20 2:38
professionalF-ES Sitecore1-Apr-20 2:38 
QuestionOverloaded Methods with Generics Pin
#realJSOP30-Mar-20 5:52
mve#realJSOP30-Mar-20 5:52 
AnswerRe: Overloaded Methods with Generics Pin
OriginalGriff30-Mar-20 6:34
mveOriginalGriff30-Mar-20 6:34 
GeneralRe: Overloaded Methods with Generics Pin
#realJSOP30-Mar-20 6:50
mve#realJSOP30-Mar-20 6:50 
GeneralRe: Overloaded Methods with Generics Pin
OriginalGriff30-Mar-20 8:28
mveOriginalGriff30-Mar-20 8:28 
GeneralRe: Overloaded Methods with Generics Pin
#realJSOP31-Mar-20 0:21
mve#realJSOP31-Mar-20 0:21 
AnswerRe: Overloaded Methods with Generics Pin
BillWoodruff30-Mar-20 16:33
professionalBillWoodruff30-Mar-20 16:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.