miniSql

创建
zgc123@gmail.com authored at 11/19/2023 1:40:15 AM
6136600
Tree
0 Parent(s)
Summary: 1 changed files with 62 additions and 0 deletions.
Added +62 -0
Added +62 -0
diff --git a/minisqlquery-master/src/MiniSqlQuery.Tests/Templates/TemplateHost_tests.cs b/minisqlquery-master/src/MiniSqlQuery.Tests/Templates/TemplateHost_tests.cs
new file mode 100644
index 0000000..405b45b
--- /dev/null
+++ b/minisqlquery-master/src/MiniSqlQuery.Tests/Templates/TemplateHost_tests.cs
@@ -0,0 +1,62 @@
+#region License
+// Copyright 2005-2019 Paul Kohler (https://github.com/paulkohler/minisqlquery). All rights reserved.
+// This source code is made available under the terms of the GNU Lesser General Public License v3.0
+// https://github.com/paulkohler/minisqlquery/blob/master/LICENSE
+#endregion
+using MiniSqlQuery.Core;
+using MiniSqlQuery.PlugIns.TemplateViewer;
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+namespace MiniSqlQuery.Tests.Templates
+{
+    [TestFixture]
+    public class TemplateHost_tests
+    {
+        private TemplateHost _host;
+        IApplicationServices _services;
+        IDatabaseInspector _databaseInspector;
+
+        [SetUp]
+        public void TestSetUp()
+        {
+            _services = MockRepository.GenerateStub<IApplicationServices>();
+            _databaseInspector = MockRepository.GenerateStub<IDatabaseInspector>();
+            _host = new TemplateHost(_services, _databaseInspector);
+        }
+
+        [Test]
+        public void UserName()
+        {
+            Assert.That(_host.UserName, Is.Not.Null);
+        }
+
+        [Test]
+        public void ToPascalCase()
+        {
+            Assert.That(_host.ToPascalCase(null), Is.EqualTo(""));
+            Assert.That(_host.ToPascalCase("name"), Is.EqualTo("Name"));
+            Assert.That(_host.ToPascalCase("foo baa"), Is.EqualTo("FooBaa"));
+            Assert.That(_host.ToPascalCase("user_id"), Is.EqualTo("UserId"));
+            Assert.That(_host.ToPascalCase("firstName"), Is.EqualTo("FirstName"));
+            Assert.That(_host.ToPascalCase("FirstName"), Is.EqualTo("FirstName"));
+            Assert.That(_host.ToPascalCase("id"), Is.EqualTo("Id"));
+            Assert.That(_host.ToPascalCase("ID"), Is.EqualTo("ID"));
+        }
+
+        [Test]
+        public void ToCamelCase()
+        {
+            Assert.That(_host.ToCamelCase(null), Is.EqualTo(""));
+            Assert.That(_host.ToCamelCase("name"), Is.EqualTo("name"));
+            Assert.That(_host.ToCamelCase("Foo"), Is.EqualTo("foo"));
+            Assert.That(_host.ToCamelCase("bat man"), Is.EqualTo("batMan"));
+            Assert.That(_host.ToCamelCase("bat_man"), Is.EqualTo("batMan"));
+            Assert.That(_host.ToCamelCase("XYZCodeThing"), Is.EqualTo("xyzCodeThing"));
+            Assert.That(_host.ToCamelCase("XYZ Code Thing"), Is.EqualTo("xyzCodeThing"));
+            Assert.That(_host.ToCamelCase("user_name"), Is.EqualTo("userName"));
+            Assert.That(_host.ToCamelCase("id"), Is.EqualTo("id"));
+        }
+    }
+}
\ No newline at end of file