public static void Main(string[] args) { Console.WriteLine("Hello from .NET!"); // // create the proxy class HelloWorld foo = new HelloWorld(); Console.WriteLine(foo.speak()); }
public void SayHelloTest() { var target = new HelloWorld(); string expected = "Hello World!"; string actual; actual = target.SayHello(); Assert.AreEqual(expected, actual); }
public void NoArgumentMethod() { MethodInfo mi = typeof(HelloWorld).GetMethod("NoArgument"); MethodRunInvoker invoker = new MethodRunInvoker(new MockRun(), mi); HelloWorld hw = new HelloWorld(); invoker.Execute(hw,new ArrayList()); Assert.IsTrue(hw.Executed); }
public static void Main(string[] args) { if (args.Length == 1) { string word = args [0]; HelloWorld webservice = new HelloWorld (); string res = webservice.helloWorld (word); Console.WriteLine (res); } }
public void Print_ShouldReturnHelloWorld_WhenCalled() { // arrange HelloWorld hello = new HelloWorld(); // act string result = hello.Print(); // assert Assert.AreEqual("Hello World", result); }
static public int constructor(IntPtr l) { try { HelloWorld o; o=new HelloWorld(); pushValue(l,true); pushValue(l,o); return 2; } catch(Exception e) { return error(l,e); } }
public static int constructor(IntPtr l) { try { HelloWorld o; o=new HelloWorld(); pushValue(l,o); return 1; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } }
public void OneArgumentMethod() { MethodInfo mi = typeof(HelloWorld).GetMethod("OneArgument"); MethodRunInvoker invoker = new MethodRunInvoker(new MockRun(), mi); HelloWorld hw = new HelloWorld(); ArrayList args = new ArrayList(); args.Add("Hello"); invoker.Execute(hw,args); Assert.IsTrue(hw.Executed); Assert.AreEqual(args[0], hw.Arg); }
public void TypesAreChangedFromEnum(object expected, HelloWorld testValue) { var target = new CustomConverterFactory(); var converter = target.GetConverter(expected.GetType()); Assert.AreEqual(expected, converter(testValue)); }
public void Setup() { Bootstrapper.Bootstrap(); _sut = ObjectFactory.GetInstance <HelloWorld>(); }
static void Main() { HelloWorld hw = new HelloWorld(); hw.Write(); //initialise all to zero with new double[] array = new double[10]; //int[] marks = new int[] { 2, 1, 5, 2, 6 }; int[] marks = { 2, 1, 5, 2, 6 }; for (int i = 0; i < 5; i++) { Console.Write("{0} \t {1} \n", array[i], marks[i]); } foreach (int i in marks) { Console.Write("{0} \t", i); } Console.WriteLine(); //List is c# equivalent of vector List <int> integers = new List <int>(); integers.Add(2); integers.Add(6); integers.Add(8); Console.WriteLine("Lists: Number of elements= {0}", integers.Count); foreach (int i in integers) { Console.Write("{0}\t", i); } Console.WriteLine("Average: {0}", integers.Average()); //you can do other stuff with strings in c# string fname, sname; fname = "Jimmy"; sname = "McCarthy"; string fullName = fname + sname; Console.WriteLine("\nHello world, my name is: {0}", fullName); //array of strings string[] sarray = { "Hello", "World", "I can", "Join", "String Arrays" }; foreach (string s in sarray) { Console.Write("{0} ", s); } Console.WriteLine(); string joint = String.Join(" ", sarray); Console.WriteLine(joint); //DateTime variable type DateTime(year month, day, hour, minute, second DateTime dt = new DateTime(2014, 01, 12, 22, 40, 00); //Format DateTime Console.WriteLine(String.Format("\nDisplay the date {0:D} at time {0:t}", dt)); Console.WriteLine("\nStringComparisons"); StringComparison[] comparisons = (StringComparison[])Enum.GetValues(typeof(StringComparison)); foreach (var comparison in comparisons) { Console.WriteLine(comparison); } sname = "jimmy"; //Default String.Equals is case sensitive if (fname.Equals(sname, StringComparison.OrdinalIgnoreCase)) { Console.WriteLine("\n {0} equals {1}", fname, sname); } else { Console.WriteLine("\n{0} does not equal {1}", fname, sname); } Console.WriteLine("\n"); Rectangle r = new Rectangle(4.5, 3.0); //r.AcceptDetails(); //Console.WriteLine("Input length:"); //r.SetLength(Convert.ToDouble(Console.ReadLine())); //Console.WriteLine("Input width:"); //r.SetWidth(Convert.ToDouble(Console.ReadLine())); r.display(); Rectangle r2 = new Rectangle(12, 5); r.addToStatVar(); r.addToStatVar(); r2.addToStatVar(); Console.WriteLine("\nstatVar= {0} for r and {1} for r2", Rectangle.getStatVar(), Rectangle.getStatVar()); Console.WriteLine("\npi= {0}", Rectangle.pi); ColouredRectangle cr = new ColouredRectangle(4.5, 3.2, "Red"); //cr.AcceptDetails(); //cr.setColour("Red"); cr.display(); Console.WriteLine("\n{0} rectangle with area {1}", cr.getColour(), cr.calcArea()); //delete r; Triangle tr = new Triangle(2, 4); tr.display(); Rectangle r3 = new Rectangle(); r3 = r + r2; r3.display(); Cards card1, card2; card1.suit = "Hearts"; card1.value = "5"; card2.suit = "Diamonds"; card2.value = "Jack"; //Console.WriteLine("\nCard1 is the {0} of {1} and Card2 is the {2} of {3}", card1.value, card1.suit, card2.value, card2.suit); Console.WriteLine(); Console.Write("Card1: "); card1.Print(); Console.WriteLine(); Console.Write("Card2: "); card2.Print(); Console.WriteLine(); Console.WriteLine("\nMonday is at position {0}", (int)Days.Mon); Console.WriteLine("\nEnter any key to exit!"); Console.ReadKey(); }
public static List <int> func8(this HelloWorld helloWorld) { helloWorld.func8(result); return(result); }
public void Sample_name() { Assert.That(HelloWorld.Hello("Alice"), Is.EqualTo("Hello, Alice!")); }
public static void Main(string[] args) { var template = new HelloWorld(){Model = new Foo()}; Console.WriteLine(template.GenerateString()); }
public int ReturnSum(int a, int b) { return(HelloWorld.ReturnSum(a, b)); }
public void Ctor_ThrowsException_InvalidCultureName() { helloWorld = new HelloWorld("Bogus"); }
public void Ctor_SetsCultureInfo_ToAustralianCulture() { helloWorld = new HelloWorld("en-AU"); Assert.AreEqual(helloWorld.CultureInfo.Name, "en-AU", "Expected CultureInfo to be set to Australian culture"); }
public void Ctor_SetsCultureInfo_ToCurrentCultureForParameterlessCtor() { helloWorld = new HelloWorld(); Assert.AreEqual(helloWorld.CultureInfo, CultureInfo.CurrentCulture, "Expected CultureInfo to be set as CurrentCulture"); }
public static void Main(string[] args) { var hw = new HelloWorld(); hw.Write(); }
public void ValidGreeings() { var greeter = new HelloWorld(DateTime.Now); var greeting = greeter.Greet("John"); Assert.That(greeting, Contains.Substring("Good")); }
public void No_name() { Assert.That(HelloWorld.Hello(null), Is.EqualTo("Hello, World!")); }
public void Other_sample_name() { Assert.That(HelloWorld.Hello("Bob"), Is.EqualTo("Hello, Bob!")); }
public void setUp() { helloWorld = new HelloWorld(); }
public int[] ReturnArray(int arrayLength) { return(HelloWorld.ReturnArray(arrayLength)); }
/// <summary> /// Runs the publisher example. /// </summary> public static void RunPublisher( int domainId, int sampleCount, uint tokenBucketPeriodMs, CancellationToken cancellationToken) { // Create a custom flow controller configuration DomainParticipantQos participantQos = ConfigureFlowController( tokenBucketPeriodMs); // Start communicating in a domain, usually one participant per application using DomainParticipant participant = DomainParticipantFactory.Instance.CreateParticipant(domainId, participantQos); // A Topic has a name and a datatype. Topic <HelloWorld> topic = participant.CreateTopic <HelloWorld>("Example cfc"); // Create a Publisher Publisher publisher = participant.CreatePublisher(); // Create a writer with the QoS specified in the default profile // in USER_QOS_PROFILES.xml, which sets up the publish mode policy DataWriter <HelloWorld> writer = publisher.CreateDataWriter(topic); // Create a sample to write with a long payload var sample = new HelloWorld { str = new string('a', 999) }; for (int count = 0; count < sampleCount && !cancellationToken.IsCancellationRequested; count++) { // Simulate a bursty writer by sending 10 samples at a time, // after sleeping for a period if (count % 10 == 0) { Thread.Sleep(1000); } // Modify the data to be sent here sample.x = count; Console.WriteLine($"Writing x={sample.x}"); // With asynchronous publish mode, the Write() puts the sample // in the queue but doesn't send it until the flow controller // indicates so. writer.Write(sample); } try { // Wait until all written samples have been actually published writer.WaitForAsynchronousPublishing(maxWait: Duration.FromSeconds(10)); // And wait until the DataReader has acknowledged them writer.WaitForAcknowledgments(maxWait: Duration.FromSeconds(10)); } catch (TimeoutException) { Console.WriteLine("Timed out waiting to publish all samples"); } }
public static void Main() { HelloWorld hw = new HelloWorld(); int result = hw.add(1, 2); Console.WriteLine("{0:C}", result); }
public void Print() { HelloWorld hw = new HelloWorld(); Assert.AreEqual("Hello world !!!", hw.Print(), "The strings should be equal"); }
public void TestSayHi() { var helloWorld = new HelloWorld(); Assert.That("Hello: world",Is.EqualTo(helloWorld.SayHi("world"))); }
} // 0x00BDEDF0-0x00BDEE70 // Extension methods public static List <int> func8(this HelloWorld helloWorld) => default; // 0x00BDED60-0x00BDEDF0
public void HelloRespondsWithName() { var helloWorld = new HelloWorld(); Assert.Contains("Mike", helloWorld.Hello("Mike")); }
public void GreetWithoutNameOK() { Assert.AreEqual("Hello World!", HelloWorld.Greet()); }
public HelloWorldUnitTest() { this._helloWorld = new HelloWorld(); }
public void GreetWithNameOK() { Assert.AreEqual("Hello Oscar!", HelloWorld.Greet("Oscar")); }
static void Main() { Console.WriteLine("Open RunExamples.cs. \nIn Main() method uncomment the example that you want to run."); Console.WriteLine("====================================================="); #region Quick Start SetLicenseFromFile.Run(); //SetLicenseFromStream.Run(); //SetMeteredLicense.Run(); HelloWorld.Run(); #endregion #region Basic Usage //GetSupportedFileFormats.Run(); //GetViewInfo.Run(); //CheckFileIsEncrypted.Run(); #region Processing attachments //RetrieveAndPrintDocumentAttachments.Run(); //RetrieveAndSaveDocumentAttachments.Run(); //RenderDocumentAttachments.Run(); #endregion #region Render document to HTML //RenderToHtmlWithEmbeddedResources.Run(); //RenderToHtmlWithExternalResources.Run(); //ExcludingFontsFromOutputHtml.Run(); //MinifyHtmlDocument.Run(); //RenderToResponsiveHtml.Run(); #endregion #region Render document to Image //RenderToPng.Run(); //RenderToJpg.Run(); //GetTextCoordinates.Run(); //RenderForDisplayWithText.Run(); //AdjustQualityWhenRenderingToJpg.Run(); //AdjustImageSize.Run(); //RenderingWmzAndWmf.Run(); //RenderingEmzAndEmf.Run(); //RenderingCdr.Run(); //RenderingCmx.Run(); //RenderingAi.Run(); //RenderingTga.Run(); //RenderingApng.Run(); #endregion #region Render document to PDF //RenderToPdf.Run(); //GetPdfStream.Run(); //AdjustQualityOfJpgImages.Run(); //ProtectPdfDocument.Run(); #endregion #endregion #region Advanced Usage #region Common rendering options //AddWatermark.Run(); //RenderDocumentWithComments.Run(); //RenderDocumentWithNotes.Run(); //RenderHiddenPages.Run(); //RenderNConsecutivePages.Run(); //RenderSelectedPages.Run(); //ReplaceMissingFont.Run(); //ReorderPages.Run(); //FlipRotatePages.Run(); //RenderWithCustomFonts.Run(); //RenderingTxt.Run(); #endregion #region Rendering options by document type #region Rendering Archive Files //GetViewInfoForArchiveFile.Run(); //RenderArchiveFolder.Run(); //SpecifyFilenameWhenRenderingArchiveFiles.Run(); //RenderingRar.Run(); //RenderingArchivesToMultipleAndSinglePagesHtml.Run(); #endregion #region Rendering E-Mail Messages //AdjustPageSize.Run(); //RenameEmailFields.Run(); #endregion #region Rendering Outlook Data Files //FilterMessages.Run(); //GetViewInfoForOutlookDataFile.Run(); //LimitCountOfItemsToRender.Run(); //RenderOutlookDataFileFolder.Run(); #endregion #region Rendering PDF Documents //DisableCharactersGrouping.Run(); //EnableFontHinting.Run(); //GetViewInfoForPdfDocument.Run(); //AdjustImageQuality.Run(); //EnableLayeredRendering.Run(); //RenderOriginalPageSize.Run(); #endregion #region Rendering MS Project Documents //AdjustTimeUnit.Run(); //GetViewInfoForProjectDocument.Run(); //RenderProjectTimeInterval.Run(); #endregion #region Rendering Spreadsheets //AdjustTextOverflowInCells.Run(); //RenderGridLines.Run(); //RenderHiddenRowsAndColumns.Run(); //RenderPrintAreas.Run(); //SkipRenderingOfEmptyColumns.Run(); //SkipRenderingOfEmptyRows.Run(); //SplitWorksheetsIntoPages.SplitByRows(); //SplitWorksheetsIntoPages.SplitByRowsAndColumns(); //RenderRowAndColumnHeadings.Run(); //GetWorksheetsNames.Run(); //RenderingNumbers.Run(); //RenderingXmlSpreadSheetML.Run(); #endregion #region Rendering Word Processing Documents //RenderTrackedChanges.Run(); #endregion #region Rendering Web documents //RenderingHtmlWithUserDefinedMargins.Run(); //RenderingChmFiles.Run(); #endregion #endregion #region Caching //UseCacheWhenProcessingDocuments.Run(); //HowToUseCustomCacheImplementation.Run(); #endregion #region Loading //LoadPasswordProtectedDocument.Run(); //LoadDocumentsWithEncoding.Run(); //SpecifyFileTypeWhenLoadingDocument.Run(); //SetResourceLoadingTimeout.Run(); #region Loading documents from different sources //LoadDocumentFromLocalDisk.Run(); //LoadDocumentFromStream.Run(); //LoadDocumentFromUrl.Run(); //LoadDocumentFromFtp.Run(); //LoadDocumentFromAmazonS3.Run(); //LoadDocumentFromAzureBlobStorage.Run(); #endregion #endregion #endregion #region HowTo //HowToDetermineFileType.FromFileExtension(); //HowToDetermineFileType.FromMediaType(); //HowToDetermineFileType.FromStream(); //HowToLogging.ToConsole(); //HowToLogging.ToFile(); #endregion Console.WriteLine(); Console.WriteLine("All done."); Console.ReadKey(); }
static void Main(string[] args) { HelloWorld hw = new HelloWorld(); hw.Hello(); }
public void NullableEnumConverterChangesTypesFromSupportedValues(object testValue, HelloWorld expected) { var target = new CustomConverterFactory(); var converter = target.GetConverter(typeof(Nullable<>).MakeGenericType(typeof(HelloWorld))); Assert.AreEqual(expected, converter(testValue)); }
public void returnHelloWorld() { HelloWorld helloWorld = new HelloWorld(); Assert.AreEqual("Hello World!", helloWorld.helloWorld()); }
public void TypesAreChangedFromEnumUsingNullableConverters(object expected, HelloWorld testValue) { var target = new CustomConverterFactory(); var converter = target.GetConverter(typeof(Nullable<>).MakeGenericType(expected.GetType())); Assert.AreEqual(expected, converter(testValue)); }
static int get_GetValue(HelloWorld world) { int value = (int)__Hotfix_get_GetValue.Invoke(world); // 调回HelloWorld.getValue自身接口 return(value + 10000); }
public void tearDown() { helloWorld = null; }
static void Test(HelloWorld world, RefOutParam <int> refValue, RefOutParam <int> outValue) { refValue.value = 10000; outValue.value = 20000; }
public Task Unsubscribe(HelloWorld.Interface.IGreetObserver observer) { var requestMessage = new RequestMessage { InvokePayload = new IGreeterWithObserver_PayloadTable.Unsubscribe_Invoke { observer = (GreetObserver)observer } }; return SendRequestAndWait(requestMessage); }
public void Setup() { Bootstrapper.Bootstrap(); _sut = ObjectFactory.GetInstance<HelloWorld>(); }
public IndexController(Kt.Framework.State.ICacheWraper CacheWraper, HelloWorld.Service.HServices HServices) { this.CacheWraper = CacheWraper; this.HServices = HServices; }
static void TestX(HelloWorld world, int x, string name) { __Hotfix_TestX_3.Invoke(world, x, name); }
public string ReturnGreeting(string hello, string addressee) { return(HelloWorld.ReturnGreeting(hello, addressee)); }
// 手动注册,替换了HelloWorld.TestField static void TestField(HelloWorld world) { UnityEngine.Debug.Log("HotHelloWorld.TestField"); }
public void Should_say_hello_world() { var sut = new HelloWorld("Hello, World!"); var results = sut.Speak(); Assert.AreEqual("Hello, World!", results); }
public void SetUp() { _mocker = new AutoMocker(); _subject = _mocker.CreateInstance <HelloWorld>(); }
static void TestX(HelloWorld world) { __Hotfix_TestX_0.Invoke(world); }
public void Say_hi() { Assert.That(HelloWorld.Hello(), Is.EqualTo("Hello, World!")); }
void IGreeterWithObserver_NoReply.Unsubscribe(HelloWorld.Interface.IGreetObserver observer) { var requestMessage = new RequestMessage { InvokePayload = new IGreeterWithObserver_PayloadTable.Unsubscribe_Invoke { observer = (GreetObserver)observer } }; SendRequest(requestMessage); }
static void TestX(HelloWorld world, string name) { __Hotfix_TestX_1.Invoke(world, name); }