Skip to content

Commit 2fb2690

Browse files
Release 6.0.0 (#27)
All new features excluding numerics and units
1 parent 556fd77 commit 2fb2690

File tree

230 files changed

+4978
-2432
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

230 files changed

+4978
-2432
lines changed

.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ root = true
22

33
[*]
44
max_line_length = 140
5+
insert_final_newline = true

.github/workflows/dotnet.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Setup .NET
2020
uses: actions/setup-dotnet@v1
2121
with:
22-
dotnet-version: 6.0.x
22+
dotnet-version: 7.0.x
2323
- name: Restore dependencies
2424
run: dotnet restore
2525
- name: Build

OnixLabs.Core.UnitTests/MockData/Color.cs renamed to OnixLabs.Core.UnitTests.Data/Objects/Color.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2020-2022 ONIXLabs
1+
// Copyright 2020-2023 ONIXLabs
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
namespace OnixLabs.Core.UnitTests.MockData;
15+
namespace OnixLabs.Core.UnitTests.Data.Objects;
1616

1717
public sealed class Color : Enumeration<Color>
1818
{
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright 2020-2023 ONIXLabs
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
namespace OnixLabs.Core.UnitTests.Data.Objects;
16+
17+
public sealed class Element
18+
{
19+
public Element(int hashCode = 0)
20+
{
21+
HashCode = hashCode;
22+
}
23+
24+
public bool Called { get; set; }
25+
private int HashCode { get; }
26+
27+
public override int GetHashCode()
28+
{
29+
return HashCode;
30+
}
31+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Copyright 2020-2023 ONIXLabs
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
using System.Numerics;
16+
17+
namespace OnixLabs.Core.UnitTests.Data.Objects;
18+
19+
public sealed class Numeric<T> : IEquatable<Numeric<T>> where T : INumber<T>
20+
{
21+
public Numeric(T value)
22+
{
23+
Value = value;
24+
}
25+
26+
public T Value { get; }
27+
28+
public bool Equals(Numeric<T>? other)
29+
{
30+
return other is not null && other.Value == Value;
31+
}
32+
33+
public override bool Equals(object? obj)
34+
{
35+
return obj is Numeric<T> other && Equals(other);
36+
}
37+
38+
public override int GetHashCode()
39+
{
40+
return HashCode.Combine(Value);
41+
}
42+
43+
public override string ToString()
44+
{
45+
return this.ToRecordString();
46+
}
47+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// Copyright 2020-2023 ONIXLabs
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
namespace OnixLabs.Core.UnitTests.Data.Objects;
16+
17+
public sealed class RecordLike : IEquatable<RecordLike>
18+
{
19+
public RecordLike(string text, int number, DateTime moment, Guid identifier)
20+
{
21+
Text = text;
22+
Number = number;
23+
Moment = moment;
24+
Identifier = identifier;
25+
}
26+
27+
public string Text { get; }
28+
public int Number { get; }
29+
public DateTime Moment { get; }
30+
public Guid Identifier { get; }
31+
32+
public bool Equals(RecordLike? other)
33+
{
34+
return ReferenceEquals(this, other)
35+
|| other is not null
36+
&& other.Text == Text
37+
&& other.Number == Number
38+
&& other.Moment == Moment
39+
&& other.Identifier == Identifier;
40+
}
41+
42+
public override bool Equals(object? obj)
43+
{
44+
return Equals(obj as RecordLike);
45+
}
46+
47+
public override int GetHashCode()
48+
{
49+
return HashCode.Combine(Text, Number, Moment, Identifier);
50+
}
51+
52+
public override string ToString()
53+
{
54+
return $"RecordLike {{ Text = {Text}, Number = {Number}, Moment = {Moment}, Identifier = {Identifier} }}";
55+
}
56+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net7.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
8+
<IsPackable>false</IsPackable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
13+
<PackageReference Include="xunit" Version="2.4.2" />
14+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
15+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
16+
<PrivateAssets>all</PrivateAssets>
17+
</PackageReference>
18+
<PackageReference Include="coverlet.collector" Version="3.1.2">
19+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
20+
<PrivateAssets>all</PrivateAssets>
21+
</PackageReference>
22+
</ItemGroup>
23+
24+
<ItemGroup>
25+
<ProjectReference Include="..\OnixLabs.Core\OnixLabs.Core.csproj" />
26+
</ItemGroup>
27+
28+
</Project>
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
// Copyright 2020-2023 ONIXLabs
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
using Xunit;
16+
17+
namespace OnixLabs.Core.UnitTests;
18+
19+
public sealed class ArrayExtensionTests
20+
{
21+
[Fact(DisplayName = "Array.Copy should produce a copy of an array")]
22+
public void CopyShouldProduceExpectedResult()
23+
{
24+
// Given
25+
int[] array = { 1, 2, 3, 4, 5 };
26+
int[] expected = { 1, 2, 3, 4, 5 };
27+
28+
// When
29+
int[] actual = array.Copy();
30+
31+
// Then
32+
Assert.Equal(expected, actual);
33+
Assert.True(!ReferenceEquals(array, actual));
34+
}
35+
36+
[Fact(DisplayName = "Array.Copy with index and count parameters should produce a copy of an array")]
37+
public void CopyWithParametersShouldProduceExpectedResult()
38+
{
39+
// Given
40+
int[] array = { 1, 2, 3, 4, 5 };
41+
int[] expected = { 3, 4, 5 };
42+
43+
// When
44+
int[] actual = array.Copy(2, 3);
45+
46+
// Then
47+
Assert.Equal(expected, actual);
48+
Assert.True(!ReferenceEquals(array, actual));
49+
}
50+
51+
[Fact(DisplayName = "Array.ConcatenateWith should produce a concatenation of two arrays")]
52+
public void ConcatenateWithShouldProduceExpectedResult()
53+
{
54+
// Given
55+
int[] left = { 1, 2, 3, 4, 5 };
56+
int[] right = { 6, 7, 8, 9, 10 };
57+
int[] expected = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
58+
59+
// When
60+
int[] actual = left.ConcatenateWith(right);
61+
62+
// Then
63+
Assert.Equal(expected, actual);
64+
}
65+
}

0 commit comments

Comments
 (0)