From 8976cf90426a53b689c6a9c41aa869dec86e8508 Mon Sep 17 00:00:00 2001 From: Jordi Date: Sat, 3 Feb 2024 10:12:42 +0100 Subject: [PATCH 1/2] Change UserReader implementation for consistency with v3. Remove legacy unnecessary Console.WriteLine traces in unit tests --- src/FakeXrmEasy.Core/CommercialLicense/UserReader.cs | 4 +++- src/FakeXrmEasy.Core/XrmFakedTracingService.cs | 2 -- .../CommercialLicense/UserReaderTests.cs | 3 ++- tests/FakeXrmEasy.Core.Tests/Issues/Issue191.cs | 1 - .../Query/FetchXml/ConditionOperatorTests.cs | 10 ---------- 5 files changed, 5 insertions(+), 15 deletions(-) diff --git a/src/FakeXrmEasy.Core/CommercialLicense/UserReader.cs b/src/FakeXrmEasy.Core/CommercialLicense/UserReader.cs index 57ac2b96..e65e0dee 100644 --- a/src/FakeXrmEasy.Core/CommercialLicense/UserReader.cs +++ b/src/FakeXrmEasy.Core/CommercialLicense/UserReader.cs @@ -1,3 +1,5 @@ +using System; + namespace FakeXrmEasy.Core.CommercialLicense { /// @@ -16,7 +18,7 @@ internal class UserReader: IUserReader { public string GetCurrentUserName() { - return System.Security.Principal.WindowsIdentity.GetCurrent().Name; + return Environment.UserName; } } } \ No newline at end of file diff --git a/src/FakeXrmEasy.Core/XrmFakedTracingService.cs b/src/FakeXrmEasy.Core/XrmFakedTracingService.cs index 79fcc2bc..0120f391 100644 --- a/src/FakeXrmEasy.Core/XrmFakedTracingService.cs +++ b/src/FakeXrmEasy.Core/XrmFakedTracingService.cs @@ -35,8 +35,6 @@ public void Trace(string format, params object[] args) } else { - Console.WriteLine(format, args); - _trace.AppendLine(string.Format(format, args)); }; } diff --git a/tests/FakeXrmEasy.Core.Tests/CommercialLicense/UserReaderTests.cs b/tests/FakeXrmEasy.Core.Tests/CommercialLicense/UserReaderTests.cs index 79d4f6d2..883c4e1f 100644 --- a/tests/FakeXrmEasy.Core.Tests/CommercialLicense/UserReaderTests.cs +++ b/tests/FakeXrmEasy.Core.Tests/CommercialLicense/UserReaderTests.cs @@ -1,3 +1,4 @@ +using System; using FakeXrmEasy.Core.CommercialLicense; using Xunit; @@ -15,7 +16,7 @@ public UserReaderTests() [Fact] public void Should_return_current_user() { - Assert.Equal(System.Security.Principal.WindowsIdentity.GetCurrent().Name, _userReader.GetCurrentUserName()); + Assert.Equal(Environment.UserName, _userReader.GetCurrentUserName()); } } } \ No newline at end of file diff --git a/tests/FakeXrmEasy.Core.Tests/Issues/Issue191.cs b/tests/FakeXrmEasy.Core.Tests/Issues/Issue191.cs index 444a0019..93607339 100644 --- a/tests/FakeXrmEasy.Core.Tests/Issues/Issue191.cs +++ b/tests/FakeXrmEasy.Core.Tests/Issues/Issue191.cs @@ -62,7 +62,6 @@ public void Testing_191() link2.LinkEntities.Add(link22); var count2 = _service.RetrieveMultiple(query2).Entities.Count; - Console.WriteLine(count2); // returns 1 record var results = _service.RetrieveMultiple(query2); Assert.True(results.Entities[0].Attributes.ContainsKey("child1.contactid")); diff --git a/tests/FakeXrmEasy.Core.Tests/Query/FetchXml/ConditionOperatorTests.cs b/tests/FakeXrmEasy.Core.Tests/Query/FetchXml/ConditionOperatorTests.cs index b3abaf1a..cd2bc1ca 100644 --- a/tests/FakeXrmEasy.Core.Tests/Query/FetchXml/ConditionOperatorTests.cs +++ b/tests/FakeXrmEasy.Core.Tests/Query/FetchXml/ConditionOperatorTests.cs @@ -2101,18 +2101,8 @@ public void FetchXml_Operator_This_Week_Execution() var today = DateTime.Today; var date = today; - var firstDayOfWeek = (int)CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek; - - Console.WriteLine($"First day of week={firstDayOfWeek}"); - - var dayOfWeek = (int)date.DayOfWeek; - Console.WriteLine($"Day of week={dayOfWeek}"); - var firstDayOfThisWeek = GetFirstDayOfWeek(date); - Console.WriteLine($"First day of this week={firstDayOfThisWeek}"); - var lastDayOfThisWeek = firstDayOfThisWeek.AddDays(6); - Console.WriteLine($"last day of this week={lastDayOfThisWeek}"); var ct1 = new Contact() { Id = Guid.NewGuid(), Anniversary = firstDayOfThisWeek }; //Should be returned var ct2 = new Contact() { Id = Guid.NewGuid(), Anniversary = lastDayOfThisWeek }; //Should be returned From e49ef22b6be21a92524e692f26c09265304a0aad Mon Sep 17 00:00:00 2001 From: Jordi Date: Sat, 3 Feb 2024 10:19:30 +0100 Subject: [PATCH 2/2] Remove release notes DynamicsValue/fake-xrm-easy#115 --- CHANGELOG.md | 4 ++++ src/FakeXrmEasy.Core/FakeXrmEasy.Core.csproj | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9474dbd1..08a37471 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ - **Alpha**: Introduced subscription usage monitoring based on customer feedback +### Changed + +- Remove ReleaseNotes from package description - https://github.com/DynamicsValue/fake-xrm-easy/issues/115 + ## [2.3.3] ### Added diff --git a/src/FakeXrmEasy.Core/FakeXrmEasy.Core.csproj b/src/FakeXrmEasy.Core/FakeXrmEasy.Core.csproj index e901975f..bee0b7c2 100644 --- a/src/FakeXrmEasy.Core/FakeXrmEasy.Core.csproj +++ b/src/FakeXrmEasy.Core/FakeXrmEasy.Core.csproj @@ -129,10 +129,6 @@ FakeXrmEasy is the open source test automation framework for .net core and the Power Platform. This is the core package containing a configurable middleware, crud operators, and query translation between FetchXml, QueryExpression, CRM LINQ, and QueryByAttribute. - -RELEASE NOTES ------------------- -@(ReleaseNoteLines, '%0a') @(ReleaseNoteLines, '%0a')