locked
Testing an appliction from the command prompt RRS feed

  • Question










  • Hi
    I'm hoping that this is the right forum.I did try to find the right one
    in 'What's the forum for..' but I have not had an answer , and I'm keen to
    press on.
    The code below is from the Microsoft 70-536 self-paced training kit , Ch5.
    It is from a lab which demonstrates the features of serialization of objects.
    I,m asked to run a test by opening a command prompt to the build directory ,
    and then test the application with the command:-
    Serialize-People Tony 1923 4 22

    I can open the Visual studio 2008 command prompt , but entering this
    line and hitting return just reults in an error message.Is this where I
    should be entering the command , or is there a tool in Visual Studio I should be using?
    be using?
    regards





    using System; using System.Collections.Generic; using System.Text; using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Serialization; using System.IO; namespace Serialize_People { // A simple program that accepts a name, year, month date, // creates a Person object from that information, // and then displays that person's age on the console. class Program { static void Main(string[] args) { if (args.Length == 0) { // If they provide no arguments, display the last person Person p = Deserialize(); Console.WriteLine(p.ToString()); } else { try { if (args.Length != 4) { throw new ArgumentException("You must provide four arguments."); } DateTime dob = new DateTime(Int32.Parse(args[1]), Int32.Parse(args[2]), Int32.Parse(args[3])); Person p = new Person(args[0], dob); Console.WriteLine(p.ToString()); Serialize(p); } catch (Exception ex) { DisplayUsageInformation(ex.Message); } } } private static void DisplayUsageInformation(string message) { Console.WriteLine("\nERROR: Invalid parameters. " + message); Console.WriteLine("\nSerialize_People \"Name\" Year Month Date"); Console.WriteLine("\nFor example:\nSerialize_People \"Tony\" 1922 11 22"); Console.WriteLine("\nOr, run the command with no arguments to display that previous person."); } private static void Serialize(Person sp) { FileStream fs = new FileStream("Person.Dat", FileMode.Create); BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(fs, sp); fs.Close(); } private static Person Deserialize() { Person dsp = new Person(); // TODO: Restore previously serialized Person object return dsp; } } }
    • Moved by Edwer Fang Friday, April 30, 2010 2:34 AM (From:Visual Studio Web Performance and Load Testing)
    Sunday, April 25, 2010 8:16 PM

Answers

  • Hello,

    I think this may not be the best place for your issue and this forum here is for the web performance testing tools of visual studio. You can try posting on the Visual C# Language Forum or  .NET Development Forums so you can get better and quicker response as there are more experts on this kind of issue.

    Thanks for your understanding. 


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com.
    • Marked as answer by Edwer Fang Friday, April 30, 2010 2:34 AM
    Wednesday, April 28, 2010 6:53 AM

All replies

  • Hello,

    I think this may not be the best place for your issue and this forum here is for the web performance testing tools of visual studio. You can try posting on the Visual C# Language Forum or  .NET Development Forums so you can get better and quicker response as there are more experts on this kind of issue.

    Thanks for your understanding. 


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com.
    • Marked as answer by Edwer Fang Friday, April 30, 2010 2:34 AM
    Wednesday, April 28, 2010 6:53 AM
  • ok Edver , thanks.
    Wednesday, April 28, 2010 10:38 AM