diff --git a/gradebook/gradebook.sln b/gradebook/gradebook.sln new file mode 100644 index 0000000..034f94b --- /dev/null +++ b/gradebook/gradebook.sln @@ -0,0 +1,56 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26124.0 +MinimumVisualStudioVersion = 15.0.26124.0 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{41D689B9-3B52-432B-97EF-63FB665C1AA7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GradeBook", "src\GradeBook\GradeBook.csproj", "{B67A3D2F-4755-46E6-960C-8746BADB002C}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{C32AB033-6E6D-4451-9194-0F6933BC383D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GradeBook.Tests", "test\GradeBook.Tests\GradeBook.Tests.csproj", "{203083CF-9050-48AC-87CC-53AF6F8F79BE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B67A3D2F-4755-46E6-960C-8746BADB002C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B67A3D2F-4755-46E6-960C-8746BADB002C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B67A3D2F-4755-46E6-960C-8746BADB002C}.Debug|x64.ActiveCfg = Debug|Any CPU + {B67A3D2F-4755-46E6-960C-8746BADB002C}.Debug|x64.Build.0 = Debug|Any CPU + {B67A3D2F-4755-46E6-960C-8746BADB002C}.Debug|x86.ActiveCfg = Debug|Any CPU + {B67A3D2F-4755-46E6-960C-8746BADB002C}.Debug|x86.Build.0 = Debug|Any CPU + {B67A3D2F-4755-46E6-960C-8746BADB002C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B67A3D2F-4755-46E6-960C-8746BADB002C}.Release|Any CPU.Build.0 = Release|Any CPU + {B67A3D2F-4755-46E6-960C-8746BADB002C}.Release|x64.ActiveCfg = Release|Any CPU + {B67A3D2F-4755-46E6-960C-8746BADB002C}.Release|x64.Build.0 = Release|Any CPU + {B67A3D2F-4755-46E6-960C-8746BADB002C}.Release|x86.ActiveCfg = Release|Any CPU + {B67A3D2F-4755-46E6-960C-8746BADB002C}.Release|x86.Build.0 = Release|Any CPU + {203083CF-9050-48AC-87CC-53AF6F8F79BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {203083CF-9050-48AC-87CC-53AF6F8F79BE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {203083CF-9050-48AC-87CC-53AF6F8F79BE}.Debug|x64.ActiveCfg = Debug|Any CPU + {203083CF-9050-48AC-87CC-53AF6F8F79BE}.Debug|x64.Build.0 = Debug|Any CPU + {203083CF-9050-48AC-87CC-53AF6F8F79BE}.Debug|x86.ActiveCfg = Debug|Any CPU + {203083CF-9050-48AC-87CC-53AF6F8F79BE}.Debug|x86.Build.0 = Debug|Any CPU + {203083CF-9050-48AC-87CC-53AF6F8F79BE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {203083CF-9050-48AC-87CC-53AF6F8F79BE}.Release|Any CPU.Build.0 = Release|Any CPU + {203083CF-9050-48AC-87CC-53AF6F8F79BE}.Release|x64.ActiveCfg = Release|Any CPU + {203083CF-9050-48AC-87CC-53AF6F8F79BE}.Release|x64.Build.0 = Release|Any CPU + {203083CF-9050-48AC-87CC-53AF6F8F79BE}.Release|x86.ActiveCfg = Release|Any CPU + {203083CF-9050-48AC-87CC-53AF6F8F79BE}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {B67A3D2F-4755-46E6-960C-8746BADB002C} = {41D689B9-3B52-432B-97EF-63FB665C1AA7} + {203083CF-9050-48AC-87CC-53AF6F8F79BE} = {C32AB033-6E6D-4451-9194-0F6933BC383D} + EndGlobalSection +EndGlobal diff --git a/gradebook/src/GradeBook/Book.cs b/gradebook/src/GradeBook/Book.cs index 04087f8..d75d2c2 100644 --- a/gradebook/src/GradeBook/Book.cs +++ b/gradebook/src/GradeBook/Book.cs @@ -3,20 +3,14 @@ using System.Collections.Generic; namespace GradeBook { - // public class Statistics - // { - // public double Average; - // public double highGrade; - // public double lowGrade; - // } public class Book { private List grades; - private string name; + public string Name; public Book(string name) { - this.name = name; + Name = name; grades = new List(); } diff --git a/gradebook/test/GradeBook.Tests/BookTests.cs b/gradebook/test/GradeBook.Tests/BookTests.cs index 3d6e91e..285d9b4 100644 --- a/gradebook/test/GradeBook.Tests/BookTests.cs +++ b/gradebook/test/GradeBook.Tests/BookTests.cs @@ -1,13 +1,12 @@ using System; using Xunit; -using GradeBook; namespace GradeBook.Tests { public class BookTests { [Fact] - public void Test1() + public void BookCalculateAnAverageGrade() { // arrange var book = new Book(""); diff --git a/gradebook/test/GradeBook.Tests/TypeTests.cs b/gradebook/test/GradeBook.Tests/TypeTests.cs new file mode 100644 index 0000000..a9a406e --- /dev/null +++ b/gradebook/test/GradeBook.Tests/TypeTests.cs @@ -0,0 +1,34 @@ +using System; +using Xunit; + +namespace GradeBook.Tests +{ + using GradeBook; + public class TypeTests + { + [Fact] + public void GetBookReturnsDifferentObjects() + { + var book1 = GetBook("Book1"); + var book2 = GetBook("Book2"); + + Assert.Equal("Book1", book1.Name); + Assert.Equal("Book2", book2.Name); + } + + public void TwoVarsCanReferenceSameObject() + { + var book1 = GetBook("Book1"); + var book2 = book1; + + Assert.Equal(book2.Name, book1.Name); + Assert.True(Object.ReferenceEquals(book1, book2)); + } + + + private Book GetBook(string name) + { + return new Book(name); + } + } +}