public void CreateConsoleType() { HelloWorldFactory fac = new HelloWorldFactory(); IHelloWorld hwAPI = fac.CreateInstance(HelloWorldTypes.Console, "test"); Assert.AreEqual(hwAPI.getGreeting(), "Hello World Console"); }
public void WriteMessage_NotImplemented() { HelloWorldFactory fac = new HelloWorldFactory(); IHelloWorld hwAPI = fac.CreateInstance(HelloWorldTypes.Console, "test"); Assert.ThrowsException <NotImplementedException>(() => hwAPI.writeMessage("test")); }
public void test_client_not_implemented() { var client = HelloWorldClient.NEW_CLIENT; var connectionString = "DB Connection string"; HelloWorldFactory.Init(connectionString); HelloWorldFactory.CreateInstance(client, connectionString); }
public void GetHelloWorldTest() { HelloWorldFactory factory = new HelloWorldFactory(new MockSettings()); IParadigm helloWorldGetter = factory.CreateHelloWorldGetter("plaintext"); string result = helloWorldGetter.GetHelloWorld(); Assert.AreEqual(result, "Hello, world!"); }
static void Main(string[] args) { HelloWorldFactory factory = new HelloWorldFactory(); // create hellowWorld obj IHelloWorld helloWorldObj = factory.CreateHelloWorldObj(); // call any of the implemented function to output "Hello World" to either console or database or other places helloWorldObj.PrintHelloWorldToConsole("Hello World"); }
static void Main(string[] args) { var helloWorld = HelloWorldFactory.Build(OutputType); helloWorld.Write(HelloWorld); Console.WriteLine("Press any key to exit."); Console.ReadKey(); }
public void test_create_mobile_type() { var client = HelloWorldClient.MOBILE; var connectionString = "DB Connection string"; HelloWorldFactory.Init(connectionString); var hwInstance = HelloWorldFactory.CreateInstance(client, connectionString); Assert.AreEqual(hwInstance.getGreeting(), "Hello " + client.ToString()); }
public void TestConsole() { var fac = new HelloWorldFactory(); var hello = fac.CreateInstance(HelloWorldConstants.HelloWorldTypes.Console, "database"); var response = hello.getMessage(); Assert.IsNotNull(response, "API returned null from API"); Assert.IsTrue(response == HelloWorldConstants.ConsoleResponse, "Helloworld API did not return valid response for console"); }
public void test_write_on_implemented_client() { var client = HelloWorldClient.MOBILE; var connectionString = "DB Connection string"; HelloWorldFactory.Init(connectionString); var hwInstance = HelloWorldFactory.CreateInstance(client, connectionString); hwInstance.setGreeting("Test"); }
public void CreateFactoryThatWrapsHelloWorldMessage() { var factory = new HelloWorldFactory(); var hw = factory.Create(); Assert.IsType <HelloWorld.Core.HelloWorld>(hw); var expected = "Hello, World"; Assert.Equal(expected, hw.Message); }
static void Main(string[] args) { var writeLocation = ConfigurationManager.AppSettings["WriteToLocation"]; HelloWorldFactory fac = new HelloWorldFactory(); IHelloWorld hwAPI = fac.CreateInstance(HelloWorldTypes.Console, writeLocation); Console.Write(hwAPI.getGreeting()); Console.ReadKey(); }
public void ReturnsHelloWorld() { // Arrange var target = new HelloWorldFactory(); // Act var result = target.Create(); // Assert Assert.IsType <DefaultHelloWorld>(result); }
static void Main(string[] args) { var logDir = ConfigurationManager.AppSettings["LogTo"].ToString(); HelloWorldFactory hwFac = new HelloWorldFactory(); IHelloWorld hwAPI = hwFac.CreateInstance(HelloWorldTypes.Console, logDir); Console.Write(hwAPI.getMessage()); Console.ReadKey(); }
public ActionResult Index() { var factory = new HelloWorldFactory(); var helloWorldPlaintextParadigm = factory.CreateHelloWorldGetter("plaintext"); var homeViewModel = new HomeViewModel { helloWorldMessage = helloWorldPlaintextParadigm.GetHelloWorld() }; return(View(homeViewModel)); }
static void Main(string[] args) { var connectionString = ConfigurationManager.AppSettings["connectionString"]; HelloWorldFactory.Init(connectionString); var hwInstance = HelloWorldFactory.CreateInstance(HelloWorldClient.CONSOLE, connectionString); hwInstance.getGreeting(); Console.WriteLine(string.Format("Greetings from console : {0}", hwInstance.getGreeting())); Console.WriteLine("Press Enter to exit..."); Console.ReadLine(); }
public void WriteMessage_NotImplemented() { HelloWorldFactory fac = new HelloWorldFactory(); IHelloWorld hwAPI = fac.CreateInstance(HelloWorldTypes.Console, "test"); try { hwAPI.writeMessage("test"); } catch (NotImplementedException e) { Assert.IsTrue(e.Message == "The method or operation is not implemented."); } }
public void TestWebService() { var fac = new HelloWorldFactory(); try { var hello = fac.CreateInstance(HelloWorldTypes.WebService, "database"); Assert.Fail("WebService exception not thrown"); } catch (Exception e) { Assert.IsTrue(e.Message == "Client 'WebService' cannot be created"); } }
public void Startup() { factory = new HelloWorldFactory(new MockSettings()); }
public void ValidateFactoryType(string outputCases) { var helloWorld = HelloWorldFactory.Build(outputCases); Assert.IsInstanceOfType(helloWorld, typeof(ConsoleHelloWorld)); }
public void ValidateNotImplimented(string outputCases) { var helloWorld = HelloWorldFactory.Build(outputCases); }
public HelloWorldDomainTest() { factory = container.Resolve <HelloWorldFactory>(); }
public void CreateMobileType() { HelloWorldFactory fac = new HelloWorldFactory(); Assert.ThrowsException <ApplicationException>(() => fac.CreateInstance(HelloWorldTypes.Mobile, "test")); }
public void SubstituteFor_CreateHelloWorld() { HelloWorldFactory factory = Substitute.For <HelloWorldFactory>(); Assert.IsInstanceOf(typeof(ConsoleApp.HelloWorld), factory.CreateHelloWorldObj()); }