예제 #1
0
        /// <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 = ZodiacHelper.InitializeAndGetAllZodiacSigns().Values
                               .FirstOrDefault(z =>
                                               (z.ZodiacStartDate.Month == requestedDateTime.Month && requestedDateTime.Day >= z.ZodiacStartDate.Date) ||
                                               (z.ZodiacEndDate.Month == requestedDateTime.Month && requestedDateTime.Day <= z.ZodiacEndDate.Date));

            return(zodiacSymbol);
        }
예제 #2
0
 /// <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(ZodiacHelper.InitializeAndGetAllZodiacSigns().Values.ToList());
 }
예제 #3
0
 /// <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)
 {
     ZodiacHelper.InitializeAndGetAllZodiacSigns().TryGetValue(requestedZodiacSign, out ZodiacModel zodiacSign);
     return(zodiacSign);
 }
예제 #4
0
        public void InitializeAndGetAllZodiacSigns_Count_Test()
        {
            var symbol = ZodiacHelper.InitializeAndGetAllZodiacSigns();

            Assert.Equal(12, symbol.Count);
        }
예제 #5
0
 public void InitializeAndGetAllZodiacSigns_ZodiacName_Test()
 {
     ZodiacHelper.InitializeAndGetAllZodiacSigns().TryGetValue(ZodiacSigns.Capricorn, out Model.ZodiacModel zodiacModel);
     Assert.Equal(ZodiacSigns.Capricorn.ToString(), zodiacModel.ZodiacName);
 }