Skip to content

Commit

Permalink
Added more comments to public methods
Browse files Browse the repository at this point in the history
Updated version to 0.0.2.
  • Loading branch information
ClydeDz committed Nov 25, 2018
1 parent 91a1684 commit 613f74e
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Src/Horoscope.TestConsole/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ static void Main(string[] args)
var symbol = Zodiac.GetZodiacSignForDate(new DateTime(1966, 2, 12));
Console.WriteLine(symbol.ZodiacName +" "+ symbol.ZodiacDuration);

symbol = Zodiac.GetZodiacSign(ZodiacSigns.Aquarius);
symbol = Zodiac.GetZodiacSign(ZodiacSigns.Capricorn);
Console.WriteLine(symbol.ZodiacDuration);

var allSymbols = Zodiac.GetAllZodiacSigns();
Expand Down
13 changes: 8 additions & 5 deletions Src/Horoscope/Horoscope.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,20 @@
<Authors>Clyde D'Souza</Authors>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<PackageId>Horoscope</PackageId>
<Version>0.0.1</Version>
<Version>0.0.2</Version>
<Company />
<PackageLicenseUrl>https://github.com/ClydeDz/horoscope-nuget/blob/master/LICENSE</PackageLicenseUrl>
<RepositoryUrl>https://github.com/ClydeDz/horoscope-nuget</RepositoryUrl>
<PackageProjectUrl>https://github.com/ClydeDz/horoscope-nuget/wiki</PackageProjectUrl>
<PackageTags>horoscope zodiac zodiac-signs development library</PackageTags>
<PackageTags>horoscope zodiac development library zodiac-signs</PackageTags>
<Description>A .NET library for Zodiac signs. Get details on each Zodiac sign, pass a date and know which Zodiac sign it falls in or get a list of all Zodiac signs. Currently in beta.</Description>
<Copyright>(c) 2018 Clyde D'Souza</Copyright>
<PackageReleaseNotes>Includes basic functionality to get Zodiac signs. Beta release.</PackageReleaseNotes>
<AssemblyVersion>0.0.0.1</AssemblyVersion>
<FileVersion>0.0.0.1</FileVersion>
<PackageReleaseNotes>0.0.2
Includes basic functionality to get Zodiac signs.
0.0.1
Beta release.</PackageReleaseNotes>
<AssemblyVersion>0.0.0.2</AssemblyVersion>
<FileVersion>0.0.0.2</FileVersion>
<PackageIconUrl>https://raw.githubusercontent.com/ClydeDz/horoscope-nuget/master/Icon.png</PackageIconUrl>
</PropertyGroup>

Expand Down
23 changes: 21 additions & 2 deletions Src/Horoscope/Model/ZodiacModel.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
namespace Horoscope.Model
{
/// <summary>
/// The Zodiac sign object containing information on each Zodiac sign.
/// </summary>
public class ZodiacModel
{
internal ZodiacModel(string name, string english, ZodiacDateModel start, ZodiacDateModel end)
Expand All @@ -10,12 +13,28 @@ internal ZodiacModel(string name, string english, ZodiacDateModel start, ZodiacD
ZodiacEndDate = end;
}

/// <summary>
/// The Zodiac latin name.
/// Example: Capricorn.
/// </summary>
public string ZodiacName { get; set; }

/// <summary>
/// The English translation of the Zodiac name.
/// Example: The Goat.
/// </summary>
public string ZodiacEnglishTranslation { get; set; }

/// <summary>
/// The duration for this Zodiac sign.
/// Example: December 22 to January 19.
/// </summary>
public string ZodiacDuration { get { return $"{ToMonth(ZodiacStartDate.Month)} {ZodiacStartDate.Date} to {ToMonth(ZodiacEndDate.Month)} {ZodiacEndDate.Date}"; } }

internal ZodiacDateModel ZodiacStartDate { get; set; }

internal ZodiacDateModel ZodiacEndDate { get; set; }
public string ZodiacDuration { get { return $"{ToMonth(ZodiacStartDate.Month)} {ZodiacStartDate.Date} to {ToMonth(ZodiacEndDate.Month)} {ZodiacEndDate.Date}"; } }


internal string ToMonth(int month)
{
switch (month)
Expand Down
24 changes: 24 additions & 0 deletions Src/Horoscope/Zodiac.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

namespace Horoscope
{
/// <summary>
/// List of all Zodiac signs
/// </summary>
public enum ZodiacSigns
{
Pisces,
Expand All @@ -21,8 +24,16 @@ public enum ZodiacSigns
Aries
}

/// <summary>
/// Contains all methods pertaining to Zodiac signs.
/// </summary>
public class Zodiac
{
/// <summary>
/// Gets the Zodiac sign for the date supplied.
/// </summary>
/// <param name="requestedDateTime">The date for which you want the Zodiac sign.</param>
/// <returns>A Zodiac sign object.</returns>
public static ZodiacModel GetZodiacSignForDate(DateTime requestedDateTime)
{
var zodiacSymbol = InitializeAndGetAllZodiacSigns().Values
Expand All @@ -34,17 +45,30 @@ public static ZodiacModel GetZodiacSignForDate(DateTime requestedDateTime)
return zodiacSymbol;
}

/// <summary>
/// Get details of the Zodiac sign supplied.
/// </summary>
/// <param name="requestedZodiacSign">The Zodiac sign that you want more details about.</param>
/// <returns>A Zodiac sign object.</returns>
public static ZodiacModel GetZodiacSign(ZodiacSigns requestedZodiacSign)
{
InitializeAndGetAllZodiacSigns().TryGetValue(requestedZodiacSign, out ZodiacModel zodiacSign);
return zodiacSign;
}

/// <summary>
/// Gets all Zodiac signs and details for each sign.
/// </summary>
/// <returns>List of Zodiac signs each as a Zodiac sign object.</returns>
public static List<ZodiacModel> GetAllZodiacSigns()
{
return InitializeAndGetAllZodiacSigns().Values.ToList();
}

/// <summary>
/// Loads all Zodiac signs and returns a complete object.
/// </summary>
/// <returns>Dictionary collection of Zodiac signs.</returns>
private static Dictionary<ZodiacSigns, ZodiacModel> InitializeAndGetAllZodiacSigns()
{
Dictionary<ZodiacSigns, ZodiacModel> zodiacSigns = new Dictionary<ZodiacSigns, ZodiacModel>
Expand Down

0 comments on commit 613f74e

Please sign in to comment.