Beispiel #1
0
        public void Encoding()
        {
            ILogger <EncodingController> _testlogger = null;

            using (var context = new AppDbContext(options, null))
            {
                var controller = new EncodingController(context, _testlogger);
                // Get all
                var result = controller.Get();
                // Assert
                var okResult = Assert.IsAssignableFrom <IEnumerable <Encoding> >(result);
                var pgcount  = okResult.ToList().Count;
                Assert.Equal(2, pgcount);
                // Get by ID
                var result1   = controller.Get(1);
                var okResult1 = Assert.IsAssignableFrom <Encoding>(result1);
                Assert.Equal("user1", okResult1.CreatedBy);
                // test update
                var pg1 = new Encoding {
                    EncodingID = 1, CreatedBy = "user1 upd"
                };
                controller.UpdateEntry(pg1);
                var result3 = controller.Get(1);
                Assert.NotEqual("user1", result3.CreatedBy);
                Assert.Equal("user1 upd", result3.CreatedBy);
                // test delete
                var result4 = controller.Get(2);
                Assert.Equal("user1", result4.CreatedBy);

                var result5    = controller.Delete(2);
                var viewResult = Assert.IsType <Microsoft.AspNetCore.Mvc.OkResult>(result5);
                var result6    = controller.Get(2);
                Assert.Null(result6);
            }
        }
Beispiel #2
0
 private void DecodeButton_Click(object sender, EventArgs e)
 {
     if (EncodingsList.SelectedItem == null)
     {
         MessageBox.Show("Select Encoding");
     }
     else
     {
         var EncodingController = new EncodingController(EncodingsList.SelectedItem.ToString());
         OutputTextBox.Text = EncodingController.Decode(InputTextBox.Text.ToLower());
     }
 }