public void CountColdMeals_Should_Return_Zero_Cold_Meals_When_Zero_Checkin_Of_Participant() { // SETUP var checkinProvider = new CheckinProvider(); var coldMealsCounter = new ColdMealsCounter(checkinProvider); // RUN var coldMealsNumber = coldMealsCounter.CountColdMeals(); // ASSERT Check.That(coldMealsNumber).IsEqualTo(0); }
public void CountColdMeals_Should_Return_One_Cold_Meal_When_Participants_Checkin_After_21h_And_Before_Midnight() { // SETUP var participantCheckinDate = new DateTime(2018, 10, 27, 21, 30, 00); var checkin = new Checkin(Email.Of("*****@*****.**"), participantCheckinDate); var checkinProvider = new CheckinProvider(checkin); var coldMealsCounter = new ColdMealsCounter(checkinProvider); // RUN var coldMealsNumber = coldMealsCounter.CountColdMeals(); // ASSERT Check.That(coldMealsNumber).IsEqualTo(1); }
public void CountColdMeals_Should_Return_Zero_Cold_Meal_When_Zero_Participant() { // SETUP var checkinProvider = Substitute.For <ICheckinProvider>(); checkinProvider.GetCheckins().Returns(Checkins.FromList(new List <Checkin>())); // RUN var coldMealsCounter = new ColdMealsCounter(checkinProvider); var coldMealsNumber = coldMealsCounter.CountColdMeals(); // ASSERT Check.That(coldMealsNumber).IsEqualTo(0); }
public void CountColdMeals_Should_Return_Two_Cold_Meal_When_Participants_Checkin_After_21h_And_Before_Midnight() { // SETUP var firstParticipantCheckinDate = new DateTime(2018, 10, 27, 21, 30, 00); var secondParticipantCheckinDate = new DateTime(2018, 10, 27, 22, 30, 00); var thirdParticipantCheckinDate = new DateTime(2018, 10, 29, 09, 30, 00); var firstCheckin = new Checkin(Email.Of("*****@*****.**"), firstParticipantCheckinDate); var secondCheckin = new Checkin(Email.Of("*****@*****.**"), secondParticipantCheckinDate); var thirdCheckin = new Checkin(Email.Of("*****@*****.**"), thirdParticipantCheckinDate); var checkinProvider = new CheckinProvider(firstCheckin, secondCheckin, thirdCheckin); var coldMealsCounter = new ColdMealsCounter(checkinProvider); // RUN var coldMealsNumber = coldMealsCounter.CountColdMeals(); // ASSERT Check.That(coldMealsNumber).IsEqualTo(2); }
public void CountColdMeals_Should_Return_Zero_Cold_Meals_When_Participants_Checkin_Before_21h() { // SETUP var checkins = new List <Checkin>(); var firstParticipantCheckin = new Checkin(Email.Of("*****@*****.**"), new DateTime(2018, 10, 27, 20, 59, 59)); var secondParticipantCheckin = new Checkin(Email.Of("*****@*****.**"), new DateTime(2018, 10, 27, 17, 13, 00)); checkins.Add(firstParticipantCheckin); checkins.Add(secondParticipantCheckin); var checkinProvider = Substitute.For <ICheckinProvider>(); checkinProvider.GetCheckins().Returns(Checkins.FromList(checkins)); // RUN var coldMealsCounter = new ColdMealsCounter(checkinProvider); var coldMealsNumber = coldMealsCounter.CountColdMeals(); // ASSERT Check.That(coldMealsNumber).IsEqualTo(0); }
private static void AddCheckin() { Console.WriteLine("\n"); var checkins = new List <Checkin>(); var addNewParticipantCheckin = false; do { var isEmailValid = false; Email email = null; do { Console.WriteLine($" Email du participant : "); string emailParticipant = Console.ReadLine(); try { email = Email.Of(emailParticipant); isEmailValid = true; } catch (InvalidEmailException invalidEmailException) { Console.WriteLine($"{invalidEmailException.Message}, veuillez resaisir l'adresse email du participant"); } }while (isEmailValid == false); var isCheckinDateValid = false; do { Console.WriteLine($" Date de checkin du participant - le format yyyy/mm/dd hh:mm:ss "); DateTime checkinDate; if (DateTime.TryParse(Console.ReadLine(), out checkinDate)) { var checkin = new Checkin(email, checkinDate); checkinProvider.Add(checkin); isCheckinDateValid = true; } else { Console.WriteLine(" Date incorrect !"); } }while (isCheckinDateValid == false); Console.WriteLine("Voulez-vous ajouter un autre participant ? [O/N]"); var responseAddNewParticipant = Console.ReadLine(); if (responseAddNewParticipant.Equals("O")) { addNewParticipantCheckin = true; } else { addNewParticipantCheckin = false; } }while (addNewParticipantCheckin == true); coldMealsCounter = new ColdMealsCounter(checkinProvider); Console.WriteLine("\n\n\n"); }