Shady nagy/net6 (#614)

* udated to .net6

* used the .net6 version RC2

* added editconfig.

* App core new Scoped Namespaces style.

* BlazorAdmin new Scoped Namespaces style.

* Blazor Shared new Scoped Namespaces style.

* Infra new Scoped Namespaces style.

* public api new Scoped Namespaces style.

* web new Scoped Namespaces style.

* FunctionalTests new Scoped Namespaces style.

* Integrational tests new Scoped Namespaces style.

* unit tests new Scoped Namespaces style.

* update github action.

* update github action.

* change the global.
This commit is contained in:
Shady Nagy
2021-11-06 01:55:48 +02:00
committed by GitHub
parent 64f150dc07
commit 9db2feb930
252 changed files with 6307 additions and 6413 deletions

View File

@@ -1,36 +1,35 @@
using Xunit;
namespace Microsoft.eShopWeb.UnitTests.ApplicationCore.Extensions
namespace Microsoft.eShopWeb.UnitTests.ApplicationCore.Extensions;
public class JsonExtensions
{
public class JsonExtensions
[Fact]
public void CorrectlySerializesAndDeserializesObject()
{
[Fact]
public void CorrectlySerializesAndDeserializesObject()
var testParent = new TestParent
{
var testParent = new TestParent
Id = 7,
Name = "Test name",
Children = new[]
{
Id = 7,
Name = "Test name",
Children = new[]
{
new TestChild(),
new TestChild(),
new TestChild()
}
};
var json = testParent.ToJson();
var result = json.FromJson<TestParent>();
Assert.Equal(testParent, result);
}
[
Theory,
InlineData("{ \"id\": 9, \"name\": \"Another test\" }", 9, "Another test"),
InlineData("{ \"id\": 3124, \"name\": \"Test Value 1\" }", 3124, "Test Value 1"),
]
public void CorrectlyDeserializesJson(string json, int expectedId, string expectedName) =>
Assert.Equal(new TestParent { Id = expectedId, Name = expectedName }, json.FromJson<TestParent>());
};
var json = testParent.ToJson();
var result = json.FromJson<TestParent>();
Assert.Equal(testParent, result);
}
}
[
Theory,
InlineData("{ \"id\": 9, \"name\": \"Another test\" }", 9, "Another test"),
InlineData("{ \"id\": 3124, \"name\": \"Test Value 1\" }", 3124, "Test Value 1"),
]
public void CorrectlyDeserializesJson(string json, int expectedId, string expectedName) =>
Assert.Equal(new TestParent { Id = expectedId, Name = expectedName }, json.FromJson<TestParent>());
}

View File

@@ -2,16 +2,15 @@
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
namespace Microsoft.eShopWeb.UnitTests.ApplicationCore.Extensions
namespace Microsoft.eShopWeb.UnitTests.ApplicationCore.Extensions;
[DebuggerDisplay("Id={Id}, Date={Date}")]
public class TestChild : IEquatable<TestChild>
{
[DebuggerDisplay("Id={Id}, Date={Date}")]
public class TestChild : IEquatable<TestChild>
{
public Guid Id { get; set; } = Guid.NewGuid();
public Guid Id { get; set; } = Guid.NewGuid();
public DateTime Date { get; set; } = DateTime.UtcNow;
public DateTime Date { get; set; } = DateTime.UtcNow;
public bool Equals([AllowNull] TestChild other) =>
other?.Date == Date && other?.Id == Id;
}
public bool Equals([AllowNull] TestChild other) =>
other?.Date == Date && other?.Id == Id;
}

View File

@@ -3,19 +3,18 @@ using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
namespace Microsoft.eShopWeb.UnitTests.ApplicationCore.Extensions
namespace Microsoft.eShopWeb.UnitTests.ApplicationCore.Extensions;
public class TestParent : IEquatable<TestParent>
{
public class TestParent : IEquatable<TestParent>
{
public int Id { get; set; }
public int Id { get; set; }
public string Name { get; set; }
public string Name { get; set; }
public IEnumerable<TestChild> Children { get; set; }
public IEnumerable<TestChild> Children { get; set; }
public bool Equals([AllowNull] TestParent other) =>
other?.Id == Id && other?.Name == Name &&
(other?.Children is null && Children is null ||
(other?.Children?.Zip(Children)?.All(t => t.First?.Equals(t.Second) ?? false) ?? false));
}
}
public bool Equals([AllowNull] TestParent other) =>
other?.Id == Id && other?.Name == Name &&
(other?.Children is null && Children is null ||
(other?.Children?.Zip(Children)?.All(t => t.First?.Equals(t.Second) ?? false) ?? false));
}