Skip to content
Open

Merge #8285

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
53226a6
Add unit tests
tpetchel Apr 4, 2019
0dc38dc
Support build configurations
tpetchel Apr 5, 2019
c6bf3a2
Add SDK version variable
tpetchel Apr 10, 2019
239f769
Add unit tests
tpetchel Apr 4, 2019
1ae708a
Support build configurations
tpetchel Apr 5, 2019
b7bee9f
Add SDK version variable
tpetchel Apr 10, 2019
5cdd89e
Add ProjectGuid
tpetchel Apr 12, 2019
82cb9dc
Merge branch 'unit-tests' of https://github.com/MicrosoftDocs/mslearn…
tpetchel Apr 12, 2019
e78924e
Change from mode to region
tpetchel Apr 12, 2019
8d5ff35
Simplify configuration
tpetchel Apr 23, 2019
76cd7eb
Ignore CodeCoverage directory
tpetchel Apr 25, 2019
9013b43
Add coverlet.msbuild package reference
tpetchel Apr 25, 2019
55bbd08
Merge branch 'master' into unit-tests
tpetchel May 22, 2019
5938c7c
Merge branch 'master' into unit-tests
tpetchel Aug 6, 2019
7f8f9a8
Merge branch 'master' into unit-tests
tpetchel Sep 25, 2019
798e261
Merge branch 'master' into unit-tests
tpetchel Oct 14, 2019
9e3a50a
Add trigger
tpetchel Nov 5, 2019
ca30eb3
update to .NET Core 3.1
jamcneil Jan 14, 2020
a0d82bb
Merge pull request #1198 from jamcneil/jm/unit-test-branch-update
tpetchel Jan 21, 2020
9430451
Merge branch 'master' into unit-tests
tpetchel Jun 1, 2020
7947ec4
Bump coverlet.msbuild to 2.9.0
tpetchel Jun 1, 2020
2d00eea
Bump Ubuntu, .NET Core, and .NET Core installer versions
tpetchel Jun 1, 2020
b8cb445
Remove reference to coverlet.msbuild
tpetchel Jun 2, 2020
afeea19
Merge pull request #3491 from MicrosoftDocs/tp/unit-tests-patch1
tpetchel Jun 3, 2020
d7cdf8f
Merge branch 'main' into unit-tests-21q3r
tpetchel May 26, 2021
e7c59fc
Bump TargetFramework
tpetchel May 26, 2021
812420e
Migrate from Newtonsoft.Json to System.Text.Json
tpetchel May 26, 2021
7d6b355
Bump package versions
tpetchel May 26, 2021
cb71776
Bump .NET, Ubuntu versions
tpetchel May 26, 2021
13d6d75
Remove "Core"
tpetchel May 26, 2021
f6d1803
Merge pull request #4974 from MicrosoftDocs/unit-tests-21q3r
tpetchel Jun 9, 2021
c381bc1
Float the dotnetSdkVersion
tpetchel Jun 21, 2021
26ea721
Merge branch 'main' into unit-tests
tpetchel Dec 10, 2021
59415db
Simplify LINQ query
tpetchel Dec 28, 2021
8b700ee
Merge branch 'main' into unit-tests
tpetchel Jun 3, 2022
2de851f
Merge branch 'main' into unit-tests
tpetchel Jun 3, 2022
acd4c47
Bump dotnet 5.x to 6.x in Test project and Pipeline (#6458)
Nighteyez07 Jul 25, 2022
c82f084
Update .net version from 6.0 to 8.0 AB#434397
May 22, 2025
c4629dd
Set up CI with Azure Pipelines
vanessatomasb Oct 16, 2025
20e85d0
Update azure-pipelines.yml for Azure Pipelines
vanessatomasb Oct 16, 2025
2341d95
Update azure-pipelines.yml for Azure Pipelines
vanessatomasb Oct 16, 2025
4d95ed7
Update azure-pipelines.yml for Azure Pipelines
vanessatomasb Oct 17, 2025
70e456e
Update azure-pipelines.yml for Azure Pipelines
vanessatomasb Oct 17, 2025
e24f4a5
Add the build configuration
vanessatomasb Oct 20, 2025
fb09440
Merge pull request #1 from vanessatomasb/code-workflow
vanessatomasb Oct 20, 2025
ae889ae
Improve the text at the top of the home page
vanessatomasb Oct 20, 2025
1e4fddf
Merge pull request #2 from vanessatomasb/feature/home-page-text
vanessatomasb Oct 20, 2025
3632492
Fix typing error on the home page
vanessatomasb Oct 21, 2025
498ca48
Merge pull request #3 from vanessatomasb/bugfix/home-page-typo
vanessatomasb Oct 21, 2025
323b0ee
Run and publish unit tests
vanessatomasb Oct 21, 2025
1a9d2ea
Add build badge
vanessatomasb Oct 21, 2025
f064cab
Merge branch 'main' into unit-tests
vanessatomasb Oct 21, 2025
2ec32dc
Merge pull request #4 from vanessatomasb/unit-tests
vanessatomasb Oct 21, 2025
b4f8bf4
Fix merge issues
vanessatomasb Oct 21, 2025
844b9bb
Merge
vanessatomasb Oct 21, 2025
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ _TeamCity*
*.coverage
*.coveragexml

[Cc]ode[Cc]overage/

# NCrunch
_NCrunch_*
.*crunch*.local.xml
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[![Build Status](https://dev.azure.com/appdev-upskilling-fy26/vanessa.b.tomas/_apis/build/status%2Fvanessatomasb.mslearn-tailspin-spacegame-web?branchName=main)](https://dev.azure.com/appdev-upskilling-fy26/vanessa.b.tomas/_build/latest?definitionId=13&branchName=main)

# Contributing

Expand Down Expand Up @@ -63,3 +64,4 @@ Privacy information can be found at https://privacy.microsoft.com/en-us/

Microsoft and any contributors reserve all other rights, whether under their respective copyrights, patents,
or trademarks, whether by implication, estoppel or otherwise.

Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq.Expressions;
using System.Threading.Tasks;
using NUnit.Framework;
using TailSpin.SpaceGame.Web;
using TailSpin.SpaceGame.Web.Models;

namespace Tests
{
public class DocumentDBRepository_GetItemsAsyncShould
{
private IDocumentDBRepository<Score> _scoreRepository;

[SetUp]
public void Setup()
{
using (Stream scoresData = typeof(IDocumentDBRepository<Score>)
.Assembly
.GetManifestResourceStream("Tailspin.SpaceGame.Web.SampleData.scores.json"))
{
_scoreRepository = new LocalDocumentDBRepository<Score>(scoresData);
}
}

[TestCase("Milky Way")]
[TestCase("Andromeda")]
[TestCase("Pinwheel")]
[TestCase("NGC 1300")]
[TestCase("Messier 82")]
public void FetchOnlyRequestedGameRegion(string gameRegion)
{
const int PAGE = 0; // take the first page of results
const int MAX_RESULTS = 10; // sample up to 10 results

// Form the query predicate.
// Select all scores for the provided game region.
Func<Score, bool> queryPredicate = score => (score.GameRegion == gameRegion);

// Fetch the scores.
Task<IEnumerable<Score>> scoresTask = _scoreRepository.GetItemsAsync(
queryPredicate, // the predicate defined above
score => 1, // we don't care about the order
PAGE,
MAX_RESULTS
);
IEnumerable<Score> scores = scoresTask.Result;

// Verify that each score's game region matches the provided game region.
Assert.That(scores, Is.All.Matches<Score>(score => score.GameRegion == gameRegion));
}
}
}
19 changes: 19 additions & 0 deletions Tailspin.SpaceGame.Web.Tests/Tailspin.SpaceGame.Web.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
<ProjectGuid>{773BA444-0D67-4F37-8762-17E108CCD5F5}</ProjectGuid>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="nunit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Tailspin.SpaceGame.Web\Tailspin.SpaceGame.Web.csproj" />
</ItemGroup>

</Project>
8 changes: 7 additions & 1 deletion Tailspin.SpaceGame.Web.sln
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tailspin.SpaceGame.Web", "Tailspin.SpaceGame.Web\Tailspin.SpaceGame.Web.csproj", "{A0C4E31E-AC75-4F39-9F59-0AA19D9B8F46}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tailspin.SpaceGame.Web.Tests", "Tailspin.SpaceGame.Web.Tests\Tailspin.SpaceGame.Web.Tests.csproj", "{773BA444-0D67-4F37-8762-17E108CCD5F5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -13,5 +15,9 @@ Global
{A0C4E31E-AC75-4F39-9F59-0AA19D9B8F46}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A0C4E31E-AC75-4F39-9F59-0AA19D9B8F46}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A0C4E31E-AC75-4F39-9F59-0AA19D9B8F46}.Release|Any CPU.Build.0 = Release|Any CPU
{773BA444-0D67-4F37-8762-17E108CCD5F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{773BA444-0D67-4F37-8762-17E108CCD5F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{773BA444-0D67-4F37-8762-17E108CCD5F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{773BA444-0D67-4F37-8762-17E108CCD5F5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
6 changes: 6 additions & 0 deletions Tailspin.SpaceGame.Web/LocalDocumentDBRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ public LocalDocumentDBRepository(string fileName)
_items = JsonSerializer.Deserialize<List<T>>(File.ReadAllText(fileName));
}

public LocalDocumentDBRepository(Stream stream)
{
// Serialize the items from the provided JSON document.
_items = JsonSerializer.Deserialize<List<T>>(new StreamReader(stream).ReadToEnd());
}

/// <summary>
/// Retrieves the item from the store with the given identifier.
/// </summary>
Expand Down
22 changes: 22 additions & 0 deletions Tailspin.SpaceGame.Web/Tailspin.SpaceGame.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,26 @@
<ItemGroup>
<Folder Include="wwwroot\images\avatars\" />
</ItemGroup>
<ItemGroup>
<Content Remove="SampleData\profiles.json" />
<Content Remove="SampleData\scores.json" />
<Content Remove="SampleData\profiles.json" />
<Content Remove="SampleData\scores.json" />
</ItemGroup>
<ItemGroup>
<Content Update="SampleData\profiles.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="SampleData\scores.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="SampleData\profiles.json">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</EmbeddedResource>
<EmbeddedResource Include="SampleData\scores.json">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</EmbeddedResource>
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Tailspin.SpaceGame.Web/Views/Home/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<section class="intro">
<div class="container">
<img class="title" src="/images/space-game-title.svg" alt="Space Game">
<p>An example site for learning</p>
<p>Welcome to the official Space Game site!</p>
</div>
</section>
<section class="download">
Expand Down
75 changes: 72 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,72 @@
pool: MyAgentPool
steps:
- bash: echo hello world
trigger:
- '*'

pool:
vmImage: 'ubuntu-20.04'
demands:
- npm

variables:
buildConfiguration: 'Release'
wwwrootDir: 'Tailspin.SpaceGame.Web/wwwroot'
dotnetSdkVersion: '8.x'

steps:
- task: UseDotNet@2
displayName: 'Use .NET SDK $(dotnetSdkVersion)'
inputs:
version: '$(dotnetSdkVersion)'

- task: NodeTool@0
displayName: 'Use Node.js 14.x'
inputs:
versionSpec: '14.x'

- task: Npm@1
displayName: 'Run npm install'
inputs:
verbose: false

- script: './node_modules/.bin/node-sass $(wwwrootDir) --output $(wwwrootDir)'
displayName: 'Compile Sass assets'

- task: gulp@1
displayName: 'Run gulp tasks'

- script: 'echo "$(Build.DefinitionName), $(Build.BuildId), $(Build.BuildNumber)" > buildinfo.txt'
displayName: 'Write build info'
workingDirectory: $(wwwrootDir)

- task: DotNetCoreCLI@2
displayName: 'Restore project dependencies'
inputs:
command: 'restore'
projects: '**/*.csproj'

- task: DotNetCoreCLI@2
displayName: 'Build the project - $(buildConfiguration)'
inputs:
command: 'build'
arguments: '--no-restore --configuration $(buildConfiguration)'
projects: '**/*.csproj'

- task: DotNetCoreCLI@2
displayName: 'Run unit tests - $(buildConfiguration)'
inputs:
command: 'test'
arguments: '--no-build --configuration $(buildConfiguration)'
publishTestResults: true
projects: '**/*.Tests.csproj'

- task: DotNetCoreCLI@2
displayName: 'Publish the project - $(buildConfiguration)'
inputs:
command: 'publish'
projects: '**/*.csproj'
publishWebProjects: false
arguments: '--no-build --configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory)/$(buildConfiguration)'
zipAfterPublish: true

- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
condition: succeeded()