From 0903001308f2c75f5d6fa404c29f3eea23f0b70b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Thu, 16 Apr 2020 22:26:28 +0300 Subject: [PATCH] Added tests --- .../TestApp/Testing/ExtraProperties_Tests.cs | 44 ++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/ExtraProperties_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/ExtraProperties_Tests.cs index 47f4c6a4cd..c624bb7a94 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/ExtraProperties_Tests.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/ExtraProperties_Tests.cs @@ -1,8 +1,10 @@ -using System.Threading.Tasks; +using System; +using System.Threading.Tasks; using Shouldly; using Volo.Abp.Data; using Volo.Abp.Modularity; using Volo.Abp.TestApp.Domain; +using Volo.Abp.Timing; using Xunit; namespace Volo.Abp.TestApp.Testing @@ -50,5 +52,45 @@ namespace Volo.Abp.TestApp.Testing london2.HasProperty("Population").ShouldBeTrue(); london2.GetProperty("Population").ShouldBe(11_000_042); } + + [Fact] + public async Task Testing_With_Different_Primitive_Types() + { + var clock = GetRequiredService(); + + var london = await CityRepository.FindByNameAsync("London"); + + london.SetProperty("IntProp", 42); + london.SetProperty("DateTimeProp", + DateTime.SpecifyKind(new DateTime( + 2020, + 04, + 16, + 22, + 05, + 41, + 999 + ), + DateTimeKind.Utc + ) + ); + + await CityRepository.UpdateAsync(london); + + var london2 = await CityRepository.FindByNameAsync("London"); + + london2.HasProperty("IntProp").ShouldBeTrue(); + london2.GetProperty("IntProp").ShouldBe(42); + + london2.HasProperty("DateTimeProp").ShouldBeTrue(); + var dateTimeProp = london2.GetProperty("DateTimeProp"); + dateTimeProp.Year.ShouldBe(2020); + dateTimeProp.Month.ShouldBe(04); + dateTimeProp.Day.ShouldBe(16); + dateTimeProp.Hour.ShouldBe(22); + dateTimeProp.Minute.ShouldBe(05); + dateTimeProp.Second.ShouldBe(41); + dateTimeProp.Millisecond.ShouldBe(999); + } } }