public void SayHello_ReturnsHello() { Greeter greeter = new Greeter("Rob"); string greeting = greeter.SayHello("Jon"); Assert.AreEqual("Hello Jon from Rob", greeting); }
public void SayHello_ReturnsHelloWithRecipientNameButNoSpeakerName() { Greeter greeter = new Greeter(null); string greeting = greeter.SayHello("Jon"); Assert.AreEqual("Hello Jon", greeting); }
public void SpeakerProperty_IsSetFromConstructor() { Greeter greeter = new Greeter("Rob"); Assert.AreEqual("Rob", greeter.Speaker); Assert.AreNotEqual("rob", greeter.Speaker); }
public void Main (string[] args) { var greeter = new Greeter(); var name = args.Length > 0 ? args[0] : "Dude"; greeter.Greet(name); ReadLine(); }
public void Should_greet_by_name_when_name_is_given() { Greeter greeter = new Greeter(); greeter.SayHello("Mike").ShouldEqual("Hello, Mike!"); IGreeter igreeter = new Greeter(); igreeter.SayHello("Mike").ShouldEqual("Hello, Mike!"); }
public void SpeakerProperty_IsWritable() { Greeter greeter = new Greeter("Rob"); greeter.Speaker = "Tom"; Assert.AreEqual("Tom", greeter.Speaker); string greeting = greeter.SayHello("Jon"); Assert.AreEqual("Hello Jon from Tom", greeting); }
public void Should_get_different_default_value_depending_on_variable_declaration() { Greeter greeter = new Greeter(); greeter.SayHello().ShouldEqual("Hello, you!"); IGreeter igreeter = new Greeter(); igreeter.SayHello().ShouldEqual("Hello, Jane!"); // WHAT!? }
public void SetUp() { _greeter = new Greeter(); _queryHandlerFactoryMock = new Mock <IQueryHandlerFactory>(); _queryHandlerFactoryMock.Setup(x => x.Create <HelloQuery>()).Returns(new HelloQueryHandler(_greeter)); }
static void Main(string[] args) { var greeter = new Greeter(); Console.WriteLine(greeter.Greet()); }
private void button1_Click(object sender, EventArgs e) { Greeter obj = new Greeter(); MessageBox.Show(obj.GetGreetingWords(txtName.Text)); }
public void Test() { var greeter = new Greeter(); greeter.ShouldNotBeNull(); }
public async Task Execute() { var result = await Greeter.SayHelloAsync(new HelloRequest { Name = "you" }); }
public static void Main(string[] args) { var greeter = new Greeter("Hello, World!"); Console.WriteLine(greeter.SayHello()); }
static void Main(string[] args) { args = new[] { "" }; args[0] = "listen"; switch (args[0].ToLower()) { case "listen": { ////using (RpcServer.CreateRpc(IID, new Impersonation(new MyService.ServerStub(new Implementation()))) //using (RpcServer.CreateRpc(IID, new Impersonation(new Greeter.ServerStub(new Implementation_Greeter()))) // //.AddAuthentication(CSharpTest.Net.RpcLibrary.RpcAuthentication.RPC_C_AUTHN_NONE) // //.AddAuthNegotiate() // .AddProtocol("ncacn_ip_tcp", "50051") // //.AddProtocol("ncacn_np", @"\pipe\Greeter") // ////.AddProtocol("ncalrpc", "MyService") // //.AddProtocol("ncalrpc", "Greeter") // .StartListening()) //{ // Console.WriteLine("Waiting for connections..."); // Console.ReadLine(); //} Guid iid = Marshal.GenerateGuidForType(typeof(IGreeter)); using (RpcServer.CreateRpc(iid, new Greeter.ServerStub(new Anonymous_Greeter())) //.AddAuthNegotiate() .AddAuthentication(CSharpTest.Net.RpcLibrary.RpcAuthentication.RPC_C_AUTHN_NONE) .AddAuthNegotiate() .AddProtocol("ncacn_ip_tcp", "50051") //.AddProtocol("ncalrpc", "Greeter") .StartListening()) { Console.WriteLine("Waiting for connections..."); string name = "123"; // Console.ReadLine(); using (Greeter client = new Greeter(RpcClient .ConnectRpc(iid, "ncacn_ip_tcp", @"localhost", "50051") .Authenticate(RpcAuthenticationType.Self) //.Authenticate(RpcAuthenticationType.None) )) { HelloReply response = client.SayHello(HelloRequest.CreateBuilder().SetName(name).Build()); Console.WriteLine("OK: " + response.Message); } Console.ReadLine(); } //Guid iid = Marshal.GenerateGuidForType(typeof(IBookService)); //using (RpcServer.CreateRpc(iid, new BookService.ServerStub(new Anonymous_BookService())) // .AddProtocol("ncacn_ip_tcp", "50051") // .AddProtocol("ncalrpc", "BookService") // .StartListening()) //{ // Console.WriteLine("Waiting for connections..."); // Console.ReadLine(); //} break; } case "send-lrpc": { using (MyService client = new MyService( RpcClient.ConnectRpc(IID, "ncalrpc", null, "MyService") .Authenticate(RpcAuthenticationType.Self))) { MyResponse response = client.Send( MyRequest.CreateBuilder().SetMessage("Hello via LRPC!").Build()); } break; } case "send-tcp": { using (MyService client = new MyService( RpcClient.ConnectRpc(IID, "ncacn_ip_tcp", @"localhost", "8080") .Authenticate(RpcAuthenticationType.Self))) { MyResponse response = client.Send( MyRequest.CreateBuilder().SetMessage("Hello via Tcp/Ip!").Build()); } break; } case "send-np": { using (MyService client = new MyService( RpcClient.ConnectRpc(IID, "ncacn_np", @"\\localhost", @"\pipe\MyService") .Authenticate(RpcAuthenticationType.Self))) { MyResponse response = client.Send( MyRequest.CreateBuilder().SetMessage("Hello via Named Pipe!").Build()); } break; } case "send-anon": { using (MyService client = new MyService( RpcClient.ConnectRpc(IID, "ncacn_np", @"\\localhost", @"\pipe\MyService") .Authenticate(RpcAuthenticationType.Anonymous))) { try { MyResponse response = client.Send( MyRequest.CreateBuilder().SetMessage("Hello from Anonymous!").Build()); } catch (Exception e) { Console.Error.WriteLine(e); } } break; } } }
public Greeter SetNext(Greeter nextGreeter) { next = nextGreeter; return(this); }
public void DefaultGreet() { var greet = Greeter.Greet(null); Assert.Equal("Hello, my friend", greet); }
public string HelloWithCustomerName(string customerName) { return(Greeter.GenericHelloWithCustomerName(customerName) + MyNameIs()); }
public string HelloWithCustomerNameAndPronoun(string customerName, string pronoun = "There") { return(Greeter.GenericHelloWithCustomerNameAndPronoun(customerName, pronoun: pronoun) + MyNameIs()); }
public string Hello() { return(Greeter.GenericHello() + MyNameIs()); }
public void TestGreetMethod() { Greeter greeter = new Greeter(); Assert.Equal("Hello there. Welcome to CSharp", greeter.greet()); }
static void Main(string[] args) { Console.WriteLine(Greeter.Greet("World")); Console.WriteLine(Greeter.Greet(null)); // with null it will throw an exception to check whether the stack traces are ok. }
public GreeterUser(string greeting, Greeter greeter) { this.greeting = greeting; this.greeter = greeter; }
public void Greet() { var greet = Greeter.Greet("Mercedes"); Assert.Equal("Hello, Mercedes", greet); }
public void TestGreetEmpty() { Greeter greeter = new Greeter(); greeter.Greet(string.Empty); }
public void Stating_something() { Assert.AreEqual("Hello world.", Greeter.Hello()); }
public GreeterShould() { _greeter = new Greeter(); }
public void ShouldReturnHelloName() { var greeter = new Greeter(); // TODO Check that "Hello Peter" and greeter.Greet("Peter") are equal. }
public static async Tasks.Task Execute() { var greeter = new Greeter(); await greeter.RunAsync(); }
public ActionResult Index() { var greeter = new Greeter(); return(View((object)greeter.Greet())); }
public void CanGreet() { var greeter=new Greeter(); string greet = greeter.Greet(); Assert.AreEqual("Hello World", greet); }
public void SaysHello() { var greeter = new Greeter(); var greet = greeter.Greet(); Assert.That(greet, Contains.Substring("hello")); }
public void Greet_HelloMessage_Receives() { Assert.Equal("Hello Jhon", Greeter.Greet("Jhon")); }
public HelloQueryHandler(Greeter greeter) { _greeter = greeter; }
static void Main(string[] args) { var greeter = new Greeter(new ConsoleOutput()); greeter.SayHello("world!"); }
public void Shout() { var greet = Greeter.Greet("MARITZA"); Assert.Equal("HELLO, MARITZA", greet); }
public void SayHello_ThrowsExceptionWithNullRecipient() { Greeter greeter = new Greeter("Rob"); Assert.Throws<ArgumentNullException>(() => greeter.SayHello(null)); }
static void Main() { var greeter = new Greeter(); }
public void ShouldReturnHelloForNull() { var greeter = new Greeter(); // TODO Check that "Hello" and greeter.Greet(null) are equal. }
public string Greet(string who) { Greeter greeter = new Greeter(); return(greeter.Greet(who)); }
public void TestGreetNull() { Greeter greeter = new Greeter(); greeter.Greet(null); }
public void ShouldIgnoreWhitespace() { var greeter = new Greeter(); // TODO Check that "Hello Peter" and greeter.Greet(" Peter ") are equal. }
public void TestGreeterMethod() { Greeter greeterToTest = new Greeter("Hello test"); string greeting = greeterToTest.SayHello(); Assert.That(greeting, Is.EqualTo("Hello test")); }
public void DoSomething() { var greeter = new Greeter(new Writer()); greeter.Greet(); }