From 6f2b41fe03a8a75e75acb19335b91008ceb0b886 Mon Sep 17 00:00:00 2001 From: Jake Soenneker Date: Sun, 4 Feb 2024 20:46:24 -0600 Subject: [PATCH] Will bring back some of this stuff shortly --- .../Base/IBaseAutoFakerConfigBuilder.cs | 15 +++--- src/Generators/Types/DateTimeGenerator.cs | 8 ++-- .../AutoConfigBuilderFixture.cs | 48 +++++++++---------- 3 files changed, 37 insertions(+), 34 deletions(-) diff --git a/src/Config/Base/IBaseAutoFakerConfigBuilder.cs b/src/Config/Base/IBaseAutoFakerConfigBuilder.cs index 4211c37..579c98d 100644 --- a/src/Config/Base/IBaseAutoFakerConfigBuilder.cs +++ b/src/Config/Base/IBaseAutoFakerConfigBuilder.cs @@ -1,5 +1,6 @@ using System; using Soenneker.Utils.AutoBogus.Abstract; +using Soenneker.Utils.AutoBogus.Context; using Soenneker.Utils.AutoBogus.Generators; namespace Soenneker.Utils.AutoBogus.Config.Base; @@ -22,14 +23,14 @@ public interface IBaseAutoFakerConfigBuilder /// /// The dateTimeKind to use. /// The current configuration builder instance. - TBuilder WithDateTimeKind(Func dateTimeKind); + //TBuilder WithDateTimeKind(Func dateTimeKind); - /// - /// Registers the DateTimeKind to use when generating date and time values. - /// - /// The dateTimeKind to use. - /// The current configuration builder instance. - TBuilder WithDateTimeKind(DateTimeKind dateTimeKind); + ///// + ///// Registers the DateTimeKind to use when generating date and time values. + ///// + ///// The dateTimeKind to use. + ///// The current configuration builder instance. + //TBuilder WithDateTimeKind(DateTimeKind dateTimeKind); /// /// Registers the number of items to generate for a collection. diff --git a/src/Generators/Types/DateTimeGenerator.cs b/src/Generators/Types/DateTimeGenerator.cs index b687f6b..6cccf58 100644 --- a/src/Generators/Types/DateTimeGenerator.cs +++ b/src/Generators/Types/DateTimeGenerator.cs @@ -10,8 +10,10 @@ internal sealed class DateTimeGenerator { object IAutoFakerGenerator.Generate(AutoFakerContext context) { - return context.AutoFakerConfig.DateTimeKind.Invoke(context) == DateTimeKind.Utc - ? context.Faker.Date.Recent().ToUniversalTime() - : context.Faker.Date.Recent(); + return context.Faker.Date.Recent(); + + //return context.Config.DateTimeKind.Invoke(context) == DateTimeKind.Utc + // ? context.Faker.Date.Recent().ToUniversalTime() + // : context.Faker.Date.Recent(); } } \ No newline at end of file diff --git a/test/Soenneker.Utils.AutoBogus.Tests/AutoConfigBuilderFixture.cs b/test/Soenneker.Utils.AutoBogus.Tests/AutoConfigBuilderFixture.cs index bfcf5d3..04ee8ec 100644 --- a/test/Soenneker.Utils.AutoBogus.Tests/AutoConfigBuilderFixture.cs +++ b/test/Soenneker.Utils.AutoBogus.Tests/AutoConfigBuilderFixture.cs @@ -40,33 +40,33 @@ public void Should_Set_Config_Locale() public class WithDateTimeKind : AutoConfigBuilderFixture { - [Fact] - public void Should_Set_Config_DateTimeKind() - { - var kind = DateTimeKind.Utc; - _builder.WithDateTimeKind(context => kind, null); - _fakerConfig.DateTimeKind.Invoke(null).Should().Be(kind); - } - - [Fact] - public void Should_Set_Config_DateTimeKind_To_Default_If_Null() - { - var kind = AutoFakerConfig.DefaultDateTimeKind.Invoke(null); - _builder.WithDateTimeKind(null, null); - _fakerConfig.DateTimeKind.Invoke(null).Should().Be(kind); - } + //[Fact] + //public void Should_Set_Config_DateTimeKind() + //{ + // var kind = DateTimeKind.Utc; + // _builder.WithDateTimeKind(context => kind, null); + // _fakerConfig.DateTimeKind.Invoke(null).Should().Be(kind); + //} + + //[Fact] + //public void Should_Set_Config_DateTimeKind_To_Default_If_Null() + //{ + // var kind = AutoFakerConfig.DefaultDateTimeKind.Invoke(null); + // _builder.WithDateTimeKind(null, null); + // _fakerConfig.DateTimeKind.Invoke(null).Should().Be(kind); + //} private sealed record Obj(DateTime Birthday); - [Fact] - public void Should_ConvertToUtc() - { - var obj = AutoFaker.Generate(builder => - { - builder.WithDateTimeKind(DateTimeKind.Utc); - }); - obj.Birthday.Should().Be(obj.Birthday.ToUniversalTime()); - } + //[Fact] + //public void Should_ConvertToUtc() + //{ + // var obj = AutoFaker.Generate(builder => + // { + // builder.WithDateTimeKind(DateTimeKind.Utc); + // }); + // obj.Birthday.Should().Be(obj.Birthday.ToUniversalTime()); + //} [Fact] public void Should_BeLocal()