-
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.
* Add recommender console app * Use general default azure credential * Add dev branch trigger * Read pred results from storage * test pipeline * Update azure-pipelines.yml for Azure Pipelines * update pipeline * update projects path * update package path in deployment * Add unit test * ignore bin and obj * Test pipeline * update pipeline * update pipeline
- Loading branch information
Showing
9 changed files
with
153 additions
and
17 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
*.DS_Store | ||
*__.json | ||
*__.json | ||
**/bin/* | ||
**/obj/* |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using System.Text; | ||
|
||
namespace My.Function; | ||
public class MockBlobStream : MemoryStream | ||
{ | ||
public override void Flush() | ||
{ | ||
// Do nothing | ||
} | ||
|
||
public override long Seek(long offset, SeekOrigin origin) | ||
{ | ||
// Do nothing | ||
return 0; | ||
} | ||
|
||
public override void SetLength(long value) | ||
{ | ||
// Do nothing | ||
} | ||
|
||
public override int Read(byte[] buffer, int offset, int count) | ||
{ | ||
// Return some test data | ||
byte[] testData = Encoding.UTF8.GetBytes("Hello, world!"); | ||
Buffer.BlockCopy(testData, 0, buffer, offset, testData.Length); | ||
return testData.Length; | ||
} | ||
|
||
public override void Write(byte[] buffer, int offset, int count) | ||
{ | ||
// Do nothing | ||
} | ||
} |
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,25 @@ | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.Extensions.Logging; | ||
using Azure.Storage.Blobs; | ||
using Moq; | ||
using My.Function; | ||
using Xunit; | ||
|
||
namespace My.Function; | ||
|
||
public class RecommendationUnitTest | ||
{ | ||
[Fact] | ||
public async Task NoToken_ShouldBeUnauthorized() | ||
{ | ||
var mockStream = new MockBlobStream(); | ||
var req = new Mock<HttpRequest>(); | ||
var log = new Mock<ILogger>(); | ||
var executionContext = new Microsoft.Azure.WebJobs.ExecutionContext(); | ||
|
||
var result = await Recommendation.Run(req.Object, mockStream, log.Object, executionContext) as StatusCodeResult; | ||
|
||
Assert.Equal(401, result.StatusCode); | ||
} | ||
} |
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 @@ | ||
global using Xunit; |
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,30 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<RootNamespace>az_function_tests</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" /> | ||
<PackageReference Include="Moq" Version="4.18.4" /> | ||
<PackageReference Include="xunit" Version="2.4.2" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<PackageReference Include="coverlet.collector" Version="3.1.2"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\az-function\az-function.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file was deleted.
Oops, something went wrong.