static void Main(string[] args) { //Task 1: Reverse String according to word ////Approach 1: Reverse Function of Array var reverseStr1 = ReverseService.ReverseStringWithReverseFunc("hello world"); Console.WriteLine(reverseStr1); ////Approach 2: "for" Cycle var reverseStr2 = ReverseService.ReverseStringWithCycle("hello world"); Console.WriteLine(reverseStr2); //Task 2: Check Array Duplicate Console.WriteLine("Please entry an int array, connect each option with \",\":"); var inputDuplicateStr = Console.ReadLine(); ////Approach 1: Array Contains var duplicateStr1 = DuplicateCheckedService.ShowDuplicateOptionWithArrayContains(inputDuplicateStr); Console.WriteLine(duplicateStr1); ////Approach 2: Double "for" Cycle var duplicateStr2 = DuplicateCheckedService.ShowDuplicateOptionWithDoubleCycle(inputDuplicateStr); Console.WriteLine(duplicateStr2); }
public void Does_Execute_ReverseService() { var response = client.Reverse(TestString); var expectedValue = ReverseService.Execute(TestString); Assert.That(response, Is.EqualTo(expectedValue)); }
public void Does_Execute_ReverseService() { var client = CreateNewServiceClient(); var response = client.Send <ReverseResponse>( new Reverse { Value = TestString }); var expectedValue = ReverseService.Execute(TestString); Assert.That(response.Result, Is.EqualTo(expectedValue)); }
public void Should_Reverse_Word() { // Arrange (przygotuj) string word = "ABC"; string reversedWord = "CBA"; ReverseService reverseService = new ReverseService(); // Act (wykonaj) string result = reverseService.ReverseWord(word); // Assert (sprawdź) Assert.AreEqual(result, reversedWord); }
public void Should_Reverse_Word() { // Arrange string word = "ABC"; string reversedWord = "CBA"; ReverseService reverseService = new ReverseService(); // Act string result = reverseService.ReverseWord(word); // Assert Assert.AreEqual(result, reversedWord); }
public static void Main(string[] args) { Server server = new Server { Services = { ReverseService.BindService(new ReverseImpl()) }, Ports = { new ServerPort("localhost", Port, ServerCredentials.Insecure) } }; server.Start(); Console.WriteLine("Reverse server listening on port " + Port); Console.WriteLine("Press any key to stop the server..."); Console.ReadKey(); server.ShutdownAsync().Wait(); }
static void Main() { int length; string[] array; ReverseService reverseService = new ReverseService(); while (true) { Console.WriteLine("Please enter length of array"); Int32.TryParse(Console.ReadLine(), out length); if (length > 0) { break; } } while (true) { Console.WriteLine("Please enter the array - separate elements using spaces"); array = Console.ReadLine().Split(" "); //There was no requirement about the type of elements. //Hence, the assumption that empty elements are ok. if (array.Length != length) { Console.WriteLine("The provided length in not equal to the given array"); } else { break; } } reverseService.Reverse(array); //String.Join will not perform the best from memory performance point of view. //It could be just a loop with Console.Write for better memory performance. //However, with String.Join the readability is better. Console.WriteLine(String.Join(" ", array)); Console.Read(); }
public void ReverseService_ReversesString() { // Arrange var actual = default(string); var input = "foo bar"; var expected = "rab oof"; // Act using (var service = new ReverseService()) { actual = service.Reverse(input); } // Asset Assert.Equal(expected, actual); }
static void Main(string[] args) { var reverseService = new ReverseService(); }
public void TestSetup() { _reverseService = new ReverseService(); }