12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- using System.Linq;
- using Luticate2.Auth.Utils.Business.Fields;
- using Luticate2.Auth.Utils.Dbo.Fields;
- using Xunit;
-
- namespace Luticate2.Auth.Tests.Business.Fields
- {
- public class LuFieldDboTests
- {
- public class TestDbo1
- {
- public string MyString { get; set; }
- }
-
- [Fact]
- public void TestMake1()
- {
- var field1 = LuFieldDbo.Make<TestDbo1>(x => x.MyString.Length);
- Assert.True(field1.Parts.SequenceEqual(new[] {"MyString", "Length"}));
- }
-
- [Fact]
- public void TestMake2()
- {
- var field1 = LuFieldDbo.Make(new[] {"MyString", "Length"});
- Assert.True(field1.Parts.SequenceEqual(new[] {"MyString", "Length"}));
- }
-
- [Fact]
- public void TestMake3()
- {
- var field1 = LuFieldDbo.Make("MyString.Length");
- Assert.True(field1.Parts.SequenceEqual(new[] {"MyString", "Length"}));
- }
-
- [Fact]
- public void TestMake4()
- {
- var field1 = LuFieldDbo.Make("MyString/Length");
- Assert.True(field1.Parts.SequenceEqual(new[] {"MyString", "Length"}));
- }
-
- [Fact]
- public void TestPop1()
- {
- var field1 = LuFieldDbo.Make<TestDbo1>(x => x.MyString.Length);
- var field2 = field1.Pop();
- Assert.True(field1.Parts.SequenceEqual(new[] {"Length"}));
- Assert.True(field2.Parts.SequenceEqual(new[] {"Length"}));
- }
-
- [Fact]
- public void TestPopped1()
- {
- var field1 = LuFieldDbo.Make<TestDbo1>(x => x.MyString.Length);
- var field2 = field1.Popped();
- Assert.True(field1.Parts.SequenceEqual(new[] {"MyString", "Length"}));
- Assert.True(field2.Parts.SequenceEqual(new[] {"Length"}));
- }
- }
- }
|