This file contains hidden or 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
| // Licensed under the MIT License | |
| public class Scoreboard | |
| { | |
| public readonly List<StudentScore> Scores = new List<StudentScore>(); | |
| // inspired by AddItem method in https://github.com/dotnet-architecture/eShopOnWeb/blob/master/src/ApplicationCore/Entities/BasketAggregate/Basket.cs | |
| public void AddScore(Student student, int score) | |
| { | |
| if (!Scores.Any(_ => _.Student.Equals(student))) | |
| { | |
| Scores.Add(new StudentScore(student, score)); |
This file contains hidden or 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
| // Licensed under the MIT License | |
| public class StudentValidationTest | |
| { | |
| [Fact] | |
| public void IsAdultAndHasPaid_IsValid() | |
| { | |
| var student = new Student(18, true); | |
| var isValid = StudentValidator.IsValid(student); | |
| Assert.True(isValid); | |
| } |
This file contains hidden or 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
| <#@ template debug="false" hostspecific="True" language="C#" #> | |
| <#@ assembly name="System.Core" #> | |
| <#@ assembly name="EnvDte" #> | |
| <#@ import namespace="System.Linq" #> | |
| <#@ import namespace="System.IO" #> | |
| <#@ import namespace="System.Collections.Generic" #> | |
| <#@ import namespace="System.Text.RegularExpressions" #> | |
| <#@ import namespace="System" #> | |
| <#@ output extension=".generated.cs" #> | |
| namespace SingleFile { |