Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: .NET

on:
push:
branches: [ "master", "development" ]
pull_request:
branches: [ "master", "development" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal
1 change: 0 additions & 1 deletion src/UtilityVerse.Shared/UtilityVerse.Shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<LangVersion>Latest</LangVersion>
<Nullable>disable</Nullable>
</PropertyGroup>

</Project>
3 changes: 0 additions & 3 deletions src/UtilityVerse/Extensions/ByteExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
// FREE TO USE TO CONNECT THE WORLD
// ---------------------------------------------------------------

using System;
using System.Xml.Serialization;
using UtilityVerse.Helpers;
using UtilityVerse.Shared;

namespace UtilityVerse.Extensions;

/// <summary>
/// Byte extensions
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion src/UtilityVerse/Extensions/CharacterExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static UtilityVerseResult<string> ToStr(this char[] characterArray, strin

return new UtilityVerseResult<string>(sb.ToString());
}
catch (System.Exception unknownException)
catch (Exception unknownException)
{
return new UtilityVerseResult<string>($"Unknown exception: {unknownException}");
}
Expand Down
2 changes: 0 additions & 2 deletions src/UtilityVerse/Extensions/CollectionExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@


using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;

namespace UtilityVerse.Extensions;

Expand Down
1 change: 0 additions & 1 deletion src/UtilityVerse/Extensions/DateOnlyExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// FREE TO USE TO CONNECT THE WORLD
// ---------------------------------------------------------------

using System;
using UtilityVerse.Shared;

namespace UtilityVerse.Extensions;
Expand Down
1 change: 0 additions & 1 deletion src/UtilityVerse/Extensions/DateTimeExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// ---------------------------------------------------------------


using System;
using UtilityVerse.Contracts;
using UtilityVerse.Helpers;
using UtilityVerse.Shared;
Expand Down
1 change: 0 additions & 1 deletion src/UtilityVerse/Extensions/GenericExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// FREE TO USE TO CONNECT THE WORLD
// ---------------------------------------------------------------

using System;
using UtilityVerse.Helpers;
using UtilityVerse.Shared;

Expand Down
2 changes: 0 additions & 2 deletions src/UtilityVerse/Extensions/IntExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// FREE TO USE TO CONNECT THE WORLD
// ---------------------------------------------------------------

using System;
using UtilityVerse.Helpers;
using UtilityVerse.Shared;

namespace UtilityVerse.Extensions;
Expand Down
1 change: 0 additions & 1 deletion src/UtilityVerse/Extensions/LongExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

using System;
using UtilityVerse.Contracts;
using UtilityVerse.Helpers;
using UtilityVerse.Shared;

namespace UtilityVerse.Extensions;
Expand Down
1 change: 0 additions & 1 deletion src/UtilityVerse/Extensions/ObjectExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// FREE TO USE TO CONNECT THE WORLD
// ---------------------------------------------------------------

using System;
using UtilityVerse.Helpers;
using UtilityVerse.Shared;

Expand Down
2 changes: 0 additions & 2 deletions src/UtilityVerse/Extensions/PagedListExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// FREE TO USE TO CONNECT THE WORLD
// ---------------------------------------------------------------

using System;
using System.Linq;
using UtilityVerse.Contracts;

namespace UtilityVerse.Extensions;
Expand Down
1 change: 0 additions & 1 deletion src/UtilityVerse/Extensions/SpanExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// ---------------------------------------------------------------


using System;
using UtilityVerse.Shared;

namespace UtilityVerse.Extensions;
Expand Down
1 change: 0 additions & 1 deletion src/UtilityVerse/Extensions/StringExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// ---------------------------------------------------------------


using System;
using System.Text;
using System.Text.RegularExpressions;
using UtilityVerse.Contracts;
Expand Down
6 changes: 1 addition & 5 deletions src/UtilityVerse/Helpers/Utils.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace UtilityVerse.Helpers;
namespace UtilityVerse.Helpers;

internal static class Utils
{
Expand Down
5 changes: 2 additions & 3 deletions src/UtilityVerse/UtilityVerse.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.1; net6.0; net8.0</TargetFrameworks>
<TargetFrameworks>netstandard2.1; net6.0; net8.0; net9.0</TargetFrameworks>
<LangVersion>Latest</LangVersion>
<Nullable>disable</Nullable>
<ImplicitUsings>disable</ImplicitUsings>
<ImplicitUsings>enable</ImplicitUsings>

<PackageLicenseExpression>MIT</PackageLicenseExpression>
<IsPackable>true</IsPackable>
Expand Down
1 change: 0 additions & 1 deletion test/UtilityVerse.Copy.Test/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using UtilityVerse.Copy.Test;
using UtilityVerse.Copy;

Console.WriteLine("Starting....");

Expand Down
28 changes: 0 additions & 28 deletions test/UtilityVerse.UnitTest/ByteExtensionTest.cs

This file was deleted.

4 changes: 3 additions & 1 deletion test/UtilityVerse.UnitTest/CollectionExtensionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// FREE TO USE TO CONNECT THE WORLD
// ----

using UtilityVerse.Extensions;

namespace UtilityVerse.UnitTest;

public class CollectionExtensionTest
Expand All @@ -24,7 +26,7 @@ public void IsNullOrEmpty_ReturnsTrue_WhenEmptyListIsProvided()
[Fact]
public void IsNullOrEmpty_ReturnsTrue_WhenNullEnumerableProvided()
{
IEnumerable<string>? result = default;
IEnumerable<string> result = default;
Assert.True(result.IsNullOrEmpty());
}

Expand Down
9 changes: 4 additions & 5 deletions test/UtilityVerse.UnitTest/CurrencyUtilityTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,20 @@ public void DollarToCent_ShouldReturnRightCent_WhenRightDollarProvided(decimal i
var calculatedValue = input * 100;
var expectedValue = Utility.DollarToCent(input);

//_output.WriteLine("Dollar {0}$, Calculated Cent {1}c, Expected Cent: {2}c ", input, calculatedValue, expectedValue);
_output.WriteLine("Dollar {0}$, Calculated Cent {1}c, Expected Cent: {2}c ", input, calculatedValue, expectedValue);

Assert.Equal(expectedValue, calculatedValue);
Assert.Equal(expectedValue.Result, calculatedValue);
}

[Theory]
[InlineData(0.1)]
[InlineData(0.0001)]
[InlineData(10)]
[InlineData(0.0001)]
public void CentToDollar_ShouldReturnRightDollar_WhenRightCentIsProvided(decimal input)
{
var calculatedValue = input / 100;
var expectedValue = Utility.CentToDollar(input);

_output.WriteLine("Cent: {0}, Calculated Dollar: {1}$, Expected Dollar: {2}$", input, calculatedValue, expectedValue);
Assert.Equal(expectedValue, calculatedValue);
Assert.Equal(expectedValue.Result, calculatedValue);
}
}
14 changes: 6 additions & 8 deletions test/UtilityVerse.UnitTest/DateOnlyExtensionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// ----

namespace UtilityVerse.UnitTest;

public class DateOnlyExtensionTest
{
[Fact]
Expand All @@ -13,9 +12,8 @@ public void IsInBetween_ReturnsTrue_IfDateIsInBetween()
DateOnly? examDate = new(2022, 01, 01);
DateOnly firstDate = new(2020, 01, 01);
DateOnly secondDate = new(2023, 01, 01);

bool result = examDate.IsInBetween(firstDate, secondDate);
Assert.True(result);
var result = examDate.Value.IsInBetween(firstDate, secondDate);
Assert.True(result.Result);
}

[Fact]
Expand All @@ -24,7 +22,7 @@ public void IsInBetween_ReturnFalse_WhenDateIsDefault()
DateOnly examDate = new();
DateOnly firstDate = new(2020, 01, 01);
DateOnly secondDate = new(2023, 01, 01);
Assert.False(examDate.IsInBetween(firstDate, secondDate));
Assert.False(examDate.IsInBetween(firstDate, secondDate).Result);
}

[Fact]
Expand All @@ -33,7 +31,7 @@ public void IsInBetween_ThrowsException_WhenDateOnlyIsNull()
DateOnly? examDate = null;
DateOnly firstDate = new(2020, 01, 01);
DateOnly secondDate = new(2023, 01, 01);
Assert.Throws<ArgumentNullException>(() => examDate.IsInBetween(firstDate, secondDate));
Assert.Throws<InvalidOperationException>(() => examDate.Value.IsInBetween(firstDate, secondDate));
}

[Fact]
Expand All @@ -42,7 +40,7 @@ public void IsInBetween_ThrowsExeption_WhenSecondDateIsNull()
DateOnly? examDate = new();
DateOnly? firstDate = new(2020, 01, 01);
DateOnly? secondDate = null;
Assert.Throws<ArgumentNullException>(() => examDate.IsInBetween(firstDate, secondDate));
Assert.Throws<InvalidOperationException>(() => examDate.Value.IsInBetween(firstDate.Value, secondDate.Value));
}

[Fact]
Expand All @@ -51,6 +49,6 @@ public void IsInBetween_ThrowsException_WhenStartDateIsHigherThanEndDate()
DateOnly examDate = new(1993, 08, 05);
DateOnly secondDate = new(1990, 01, 01);
DateOnly firstDate = new(2000, 01, 01);
Assert.Throws<ArgumentOutOfRangeException>(() => examDate.IsInBetween(firstDate, secondDate));
Assert.False(examDate.IsInBetween(firstDate, secondDate).Result);
}
}
77 changes: 0 additions & 77 deletions test/UtilityVerse.UnitTest/DateTimeExtensionTest.cs

This file was deleted.

4 changes: 2 additions & 2 deletions test/UtilityVerse.UnitTest/GenericExtensionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ public void ToByteArray_ReturnsValidByteArray_WhenValidInputIsProvided()
public void To_ThrowException_WhenNullByteArrayIsGiven()
{
byte[] array = default;
Assert.Throws<Exception>(() => array.To<User>().Result);
Assert.Null(array.To<User>().Result);
}

[Fact]
public void ToByteArray_ThrowsException_WhenNullClassIsProvided()
{
User user = default;
Assert.Throws<Exception>(() => user.ToByteArray().Result);
Assert.Null(user.ToByteArray().Result);
}
}
Loading