-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dbb9a53
commit 0406979
Showing
5 changed files
with
103 additions
and
5 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
Creational/DesignPatterns.AbstractFactory.UnitTests/DataLake/StorageFactoryTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Azure.Storage.Files.DataLake; | ||
using DesignPatterns.AbstractFactory.DataLake; | ||
using FluentAssertions; | ||
using FluentAssertions.Execution; | ||
using Moq; | ||
using Xunit; | ||
|
||
namespace DesignPatterns.AbstractFactory.UnitTests.DataLake; | ||
|
||
public class StorageFactoryTests | ||
{ | ||
[Fact] | ||
public void Given_WhenCallCreate_ThenResultAsExpected() | ||
{ | ||
var mockSettings = new Mock<StorageSettings>(); | ||
var mockServiceClient = new Mock<DataLakeServiceClient>(); | ||
var storageFactory = new StorageFactory(mockSettings.Object, mockServiceClient.Object); | ||
|
||
IStorage? result = null; | ||
var action = () => result = storageFactory.Create(); | ||
using (new AssertionScope()) | ||
{ | ||
action.Should().NotThrow(); | ||
result.Should().NotBeNull(); | ||
result.Should().BeOfType<Storage>(); | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
.../DesignPatterns.AbstractFactory.UnitTests/DesignPatterns.AbstractFactory.UnitTests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<RootNamespace>DesignPatterns.AbstractFactory.UnitTests</RootNamespace> | ||
<IsPackable>false</IsPackable> | ||
<IsTestProject>true</IsTestProject> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="AutoFixture" Version="4.18.1" /> | ||
<PackageReference Include="FluentAssertions" Version="6.12.0" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" /> | ||
<PackageReference Include="Moq" Version="4.20.70" /> | ||
<PackageReference Include="Shouldly" Version="4.2.1" /> | ||
<PackageReference Include="xunit" Version="2.6.5" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<PackageReference Include="coverlet.collector" Version="6.0.0"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<PackageReference Include="coverlet.msbuild" Version="6.0.0"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\DesignPatterns.AbstractFactory\DesignPatterns.AbstractFactory.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
26 changes: 26 additions & 0 deletions
26
Creational/DesignPatterns.AbstractFactory.UnitTests/Local/StorageFactoryTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using DesignPatterns.AbstractFactory.Local; | ||
using FluentAssertions; | ||
using FluentAssertions.Execution; | ||
using Moq; | ||
using Xunit; | ||
|
||
namespace DesignPatterns.AbstractFactory.UnitTests.Local; | ||
|
||
public class StorageFactoryTests | ||
{ | ||
[Fact] | ||
public void Given_WhenCallCreate_ThenResultAsExpected() | ||
{ | ||
var mockSettings = new Mock<StorageSettings>(); | ||
var storageFactory = new StorageFactory(mockSettings.Object); | ||
|
||
IStorage? result = null; | ||
var action = () => result = storageFactory.Create(); | ||
using (new AssertionScope()) | ||
{ | ||
action.Should().NotThrow(); | ||
result.Should().NotBeNull(); | ||
result.Should().BeOfType<Storage>(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters