コード例 #1
0
        // GET api/hello/5
        public HelloModel Get(int id)
        {
            var repo   = new HelloWorldRepository();
            var rvalue = repo.GetHelloWorldById(id);

            return(rvalue);
        }
コード例 #2
0
        // DELETE api/hello/5
        public void Delete(int id)
        {
            //making change
            var repo = new HelloWorldRepository();

            repo.DeleteHelloWorldById(id);
        }
コード例 #3
0
        // POST api/hello
        public void Post([FromBody] string value)
        {
            // this is a change
            var repo = new HelloWorldRepository();

            repo.Insert_HelloWorld(value);
        }
コード例 #4
0
        // GET api/hello
        public IEnumerable <HelloModel> Get()
        {
            var repo  = new HelloWorldRepository();
            var hello = repo.GetAllHelloWorld();

            return(hello);
        }
コード例 #5
0
        public void EmptyTest()
        {
            HelloWorldRepository repo = TestRepo();

            var result = repo.ListAll();

            Assert.Empty(result);
        }
コード例 #6
0
        // 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);
        }
コード例 #7
0
        public void ReturnsHelloWorldItemTest()
        {
            HelloWorldRepository repo = TestRepo();

            repo.Add();

            var result = repo.Get(1);

            Assert.Equal("Hello World", result.Text);
        }
コード例 #8
0
        public void SingleItemTest()
        {
            HelloWorldRepository repo = TestRepo();

            repo.Add();

            var result = repo.ListAll();

            Assert.Single(result);
        }
コード例 #9
0
        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");
        }
コード例 #10
0
        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);
        }
コード例 #11
0
        /// <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();
        }
コード例 #12
0
        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);
        }
コード例 #13
0
        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);
        }
コード例 #14
0
ファイル: HelloWorld.cs プロジェクト: divamatrix/CroweDemo
 public HelloWorldController()
 {
     helloWorldRepository = new HelloWorldRepository();
 }
コード例 #15
0
ファイル: HelloWorld.cs プロジェクト: divamatrix/CroweDemo
 public HelloWorldController(IRequestContext requestContext, IGlassHtml glassHtml, RenderingContext renderingContextWrapper, HttpContextBase httpContext)
 {
     helloWorldRepository = new HelloWorldRepository();
 }