// GET api/hello/5 public HelloModel Get(int id) { var repo = new HelloWorldRepository(); var rvalue = repo.GetHelloWorldById(id); return(rvalue); }
// DELETE api/hello/5 public void Delete(int id) { //making change var repo = new HelloWorldRepository(); repo.DeleteHelloWorldById(id); }
// POST api/hello public void Post([FromBody] string value) { // this is a change var repo = new HelloWorldRepository(); repo.Insert_HelloWorld(value); }
// GET api/hello public IEnumerable <HelloModel> Get() { var repo = new HelloWorldRepository(); var hello = repo.GetAllHelloWorld(); return(hello); }
public void EmptyTest() { HelloWorldRepository repo = TestRepo(); var result = repo.ListAll(); Assert.Empty(result); }
// PUT api/hello/5 public void Put(int id, [FromBody] string value) { var repo = new HelloWorldRepository(); var hello = new HelloModel() { Id = id, Message = value }; repo.UpdateHelloWorld(hello); }
public void ReturnsHelloWorldItemTest() { HelloWorldRepository repo = TestRepo(); repo.Add(); var result = repo.Get(1); Assert.Equal("Hello World", result.Text); }
public void SingleItemTest() { HelloWorldRepository repo = TestRepo(); repo.Add(); var result = repo.ListAll(); Assert.Single(result); }
public async Task Test() { DbContextOptions <HelloWorldContext> options = new DbContextOptions <HelloWorldContext>(); HelloWorldContext context = new HelloWorldContext(options); HelloWorldRepository repo = new HelloWorldRepository(context); HelloWorldController controller = new HelloWorldController(repo); string str = await controller.GetStringAsync(); Assert.AreEqual(str, "Hello World"); }
private static HelloWorldRepository TestRepo() { var builder = new DbContextOptionsBuilder <HelloWorldContext>(); builder.UseInMemoryDatabase(databaseName: "TestRepo"); var context = new HelloWorldContext(builder.Options); var repo = new HelloWorldRepository(context); return(repo); }
/// <summary> /// Entry point into the console app /// </summary> /// <param name="args"></param> static void Main(string[] args) { Console.WriteLine("Getting data from the web API, Please wait.........."); //To give sufficient time for web API to get hosted in local IIS Thread.Sleep(2000); IHelloWorldRepository repo = new HelloWorldRepository(); IHelloWorldService service = new HelloWorldService(repo); HelloWorldApp app = new HelloWorldApp(service); app.start(); Console.ReadKey(); }
public void Check_If_Data_Exist_Table() { var testRequest = SetupTestRecord(); var testId = testRequest.id; var HWRepo = new HelloWorldRepository(); HWRepo.Add(testRequest); var hwdata = _db.DataInputs .Where(rr => rr.id == testRequest.id) .SingleOrDefault(); Assert.IsNotNull(hwdata); CleanUpTestRecord(testId); }
public static string Hello(string name) { string responseHelloWorld = string.Empty; try { HelloWorldRepository wordRepo = new HelloWorldRepository(); responseHelloWorld = wordRepo.Say_Hello(name); } catch (Exception ex) { //mesajele de eroare se logheaz in baza de date intr-o tabela de log-uri var mesajEroare = ex.Message; } return(responseHelloWorld); }
public HelloWorldController() { helloWorldRepository = new HelloWorldRepository(); }
public HelloWorldController(IRequestContext requestContext, IGlassHtml glassHtml, RenderingContext renderingContextWrapper, HttpContextBase httpContext) { helloWorldRepository = new HelloWorldRepository(); }