Skip to content

Commit

Permalink
Editor-config formatting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Oren Novotny committed Jun 30, 2018
1 parent ba776f3 commit 2bbb4d8
Show file tree
Hide file tree
Showing 176 changed files with 6,274 additions and 5,357 deletions.
7 changes: 1 addition & 6 deletions src/Humanizer.Tests.Shared/BitFieldEnumHumanizeTests.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
using Xunit;

namespace Humanizer.Tests
{
Expand Down
5 changes: 0 additions & 5 deletions src/Humanizer.Tests.Shared/BitFieldEnumUnderTest.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Humanizer.Tests
{
Expand Down
4 changes: 2 additions & 2 deletions src/Humanizer.Tests.Shared/Bytes/ComparingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public void CompareUntyped(double value, double valueToCompareWith, int expected
}

[Theory]
[InlineData(new[] { "1GB", "3KB", "5MB" }, new[] { "3KB", "5MB", "1GB"})]
[InlineData(new[] { "1MB", "3KB", "5MB" }, new[] { "3KB", "1MB", "5MB"})]
[InlineData(new[] { "1GB", "3KB", "5MB" }, new[] { "3KB", "5MB", "1GB" })]
[InlineData(new[] { "1MB", "3KB", "5MB" }, new[] { "3KB", "1MB", "5MB" })]
public void SortList(IEnumerable<string> values, IEnumerable<string> expected)
{
var list = values.Select(ByteSize.Parse).ToList();
Expand Down
2 changes: 1 addition & 1 deletion src/Humanizer.Tests.Shared/Bytes/CreatingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class CreatingTests
public void Constructor()
{
var result = new ByteSize(1099511627776);

Assert.Equal(8.796093022208e12, result.Bits);
Assert.Equal(1099511627776, result.Bytes);
Assert.Equal(1073741824, result.Kilobytes);
Expand Down
2 changes: 1 addition & 1 deletion src/Humanizer.Tests.Shared/CollectionHumanizeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public void HumanizeHandlesNullItemsWithoutAnException()
[Fact]
public void HumanizeHandlesNullStringDisplayFormatterReturnsWithoutAnException()
{
Assert.Null(Record.Exception(() => new[] { "A", "B", "C" }.Humanize(_ => (string)null)));
Assert.Null(Record.Exception(() => new[] { "A", "B", "C" }.Humanize(_ => null)));
}

[Fact]
Expand Down
19 changes: 13 additions & 6 deletions src/Humanizer.Tests.Shared/DateHumanize.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ namespace Humanizer.Tests
{
public class DateHumanize
{
readonly static object LockObject = new object();
static void VerifyWithCurrentDate(string expectedString, TimeSpan deltaFromNow, CultureInfo culture)
private static readonly object LockObject = new object();

private static void VerifyWithCurrentDate(string expectedString, TimeSpan deltaFromNow, CultureInfo culture)
{
var utcNow = DateTime.UtcNow;
var localNow = DateTime.Now;
Expand All @@ -19,15 +20,15 @@ static void VerifyWithCurrentDate(string expectedString, TimeSpan deltaFromNow,
VerifyWithDate(expectedString, deltaFromNow, culture, localNow, utcNow);
}

static void VerifyWithDateInjection(string expectedString, TimeSpan deltaFromNow, CultureInfo culture)
private static void VerifyWithDateInjection(string expectedString, TimeSpan deltaFromNow, CultureInfo culture)
{
var utcNow = new DateTime(2013, 6, 20, 9, 58, 22, DateTimeKind.Utc);
var now = new DateTime(2013, 6, 20, 11, 58, 22, DateTimeKind.Local);

VerifyWithDate(expectedString, deltaFromNow, culture, now, utcNow);
}

static void VerifyWithDate(string expectedString, TimeSpan deltaFromBase, CultureInfo culture, DateTime baseDate, DateTime baseDateUtc)
private static void VerifyWithDate(string expectedString, TimeSpan deltaFromBase, CultureInfo culture, DateTime baseDate, DateTime baseDateUtc)
{
Assert.Equal(expectedString, baseDateUtc.Add(deltaFromBase).Humanize(utcDate: true, dateToCompareAgainst: baseDateUtc, culture: culture));
Assert.Equal(expectedString, baseDate.Add(deltaFromBase).Humanize(false, baseDate, culture: culture));
Expand All @@ -39,15 +40,21 @@ public static void Verify(string expectedString, int unit, TimeUnit timeUnit, Te
lock (LockObject)
{
if (precision.HasValue)
{
Configurator.DateTimeHumanizeStrategy = new PrecisionDateTimeHumanizeStrategy(precision.Value);
}
else
{
Configurator.DateTimeHumanizeStrategy = new DefaultDateTimeHumanizeStrategy();
}

var deltaFromNow = new TimeSpan();
unit = Math.Abs(unit);

if (tense == Tense.Past)
{
unit = -unit;
}

switch (timeUnit)
{
Expand All @@ -67,10 +74,10 @@ public static void Verify(string expectedString, int unit, TimeUnit timeUnit, Te
deltaFromNow = TimeSpan.FromDays(unit);
break;
case TimeUnit.Month:
deltaFromNow = TimeSpan.FromDays(unit*31);
deltaFromNow = TimeSpan.FromDays(unit * 31);
break;
case TimeUnit.Year:
deltaFromNow = TimeSpan.FromDays(unit*366);
deltaFromNow = TimeSpan.FromDays(unit * 366);
break;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Globalization;
using System;
using System.Globalization;
using Humanizer.Localisation;
using Xunit;
using System;

namespace Humanizer.Tests
{
Expand Down
3 changes: 0 additions & 3 deletions src/Humanizer.Tests.Shared/DateTimeOffsetHumanizeTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Humanizer.Configuration;
using Humanizer.DateTimeHumanizeStrategy;
using Xunit;
Expand Down
6 changes: 3 additions & 3 deletions src/Humanizer.Tests.Shared/DehumanizeToEnumTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void HonorsLocalizedDisplayAttribute()
Assert.Equal(EnumUnderTest.MemberWithLocalizedDisplayAttribute, EnumTestsResources.MemberWithLocalizedDisplayAttribute.DehumanizeTo(typeof(EnumUnderTest)));
}

struct DummyStructWithEnumInterfaces : IComparable, IFormattable
private struct DummyStructWithEnumInterfaces : IComparable, IFormattable
{
public int CompareTo(object obj)
{
Expand Down Expand Up @@ -185,13 +185,13 @@ public object ToType(Type conversionType, IFormatProvider provider)
}
}

enum DummyEnum
private enum DummyEnum
{
First,
Second
}
}



}
16 changes: 8 additions & 8 deletions src/Humanizer.Tests.Shared/EnumHumanizeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Humanizer.Tests
public class EnumHumanizeTests
{
#if !NETFX_CORE
[Fact]
[Fact]
public void HonorsDescriptionAttribute()
{
Assert.Equal(EnumTestsResources.MemberWithDescriptionAttribute, EnumUnderTest.MemberWithDescriptionAttribute.Humanize());
Expand All @@ -30,29 +30,29 @@ public void OnlyStringDescriptionsApply()
Assert.Equal(EnumTestsResources.MemberWithImposterDescriptionAttribute, EnumUnderTest.MemberWithImposterDescriptionAttribute.Humanize());
}

[Fact]
[Fact]
public void CanHumanizeMembersWithoutDescriptionAttribute()
{
Assert.Equal(EnumTestsResources.MemberWithoutDescriptionAttributeSentence, EnumUnderTest.MemberWithoutDescriptionAttribute.Humanize());
}

[Fact]
[Fact]
public void CanApplyTitleCasingOnEnumHumanization()
{
Assert.Equal(
EnumTestsResources.MemberWithoutDescriptionAttributeTitle,
EnumTestsResources.MemberWithoutDescriptionAttributeTitle,
EnumUnderTest.MemberWithoutDescriptionAttribute.Humanize(LetterCasing.Title));
}

[Fact]
[Fact]
public void CanApplyLowerCaseCasingOnEnumHumanization()
{
Assert.Equal(
EnumTestsResources.MemberWithoutDescriptionAttributeLowerCase,
EnumTestsResources.MemberWithoutDescriptionAttributeLowerCase,
EnumUnderTest.MemberWithoutDescriptionAttribute.Humanize(LetterCasing.LowerCase));
}

[Fact]
[Fact]
public void AllCapitalMembersAreReturnedAsIs()
{
Assert.Equal(EnumUnderTest.ALLCAPITALS.ToString(), EnumUnderTest.ALLCAPITALS.Humanize());
Expand All @@ -74,6 +74,6 @@ public void HonorsLocalizedDisplayAttribute()
{
Assert.Equal(EnumTestsResources.MemberWithLocalizedDisplayAttribute, EnumUnderTest.MemberWithLocalizedDisplayAttribute.Humanize());
}

}
}
2 changes: 1 addition & 1 deletion src/Humanizer.Tests.Shared/EnumUnderTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public CustomDescriptionAttribute(string description)
#if !NETFX_CORE
public class DescriptionSubclassAttribute : DescriptionAttribute
{
public DescriptionSubclassAttribute(string description):base(description)
public DescriptionSubclassAttribute(string description) : base(description)
{
}

Expand Down
Loading

0 comments on commit 2bbb4d8

Please sign in to comment.