Exemplo n.º 1
0
        public void Should_Create_your_composition_from_Abstraction_For_Validate_The_Tables()
        {
            var element      = NSubstitute.Substitute.For <ITables>();
            var listReturned = new List <Table>();

            listReturned.Add(Table.Of("Table-1", "Durant", "Damien", "Meat", mealAllowed));
            listReturned.Add(Table.Of("Table-2", "Lamier", "Lola", "Meat", mealAllowed));
            listReturned.Add(Table.Of("Table-1", "Durant", "Laurent", "Fish", mealAllowed));

            var tableNumberFoodEstimated   = new List <TableMealsNumbers>();
            var mealDicoEstimatedForTable1 = new Dictionary <string, int>();

            mealDicoEstimatedForTable1.Add("Meat", 1);
            mealDicoEstimatedForTable1.Add("Fish", 1);
            tableNumberFoodEstimated.Add(new TableMealsNumbers("Table-1", mealDicoEstimatedForTable1));

            var mealDicoEstimatedForTable2 = new Dictionary <string, int>();

            mealDicoEstimatedForTable2.Add("Meat", 1);
            mealDicoEstimatedForTable2.Add("Fish", 0);
            tableNumberFoodEstimated.Add(new TableMealsNumbers("Table-2", mealDicoEstimatedForTable2));


            element.ObtainsTheTables().Returns(listReturned);
            var                      tableRepository   = new TableRepository(element);
            List <Table>             tableInformations = tableRepository.ObtainTableList();
            var                      tableInformation  = new TableInformation(tableInformations);
            List <TableMealsNumbers> tableNumberFood   = tableInformation.ObtainMealNumberForAllTheTables(dictionaryMealAllowed);

            Check.That(tableNumberFood.SequenceEqual(tableNumberFoodEstimated) && tableNumberFoodEstimated.SequenceEqual(tableNumberFood)).IsTrue();
        }
Exemplo n.º 2
0
        public void Should_Create_Your_Composition_With_The_Abstraction_For_The_MealEstimated()
        {
            var element = NSubstitute.Substitute.For <ITables>();

            var mealAllowedAbstraction = NSubstitute.Substitute.For <IMealAllowed>();

            mealAllowedAbstraction.ObtainTheMealAllowed().Returns(mealAllowed);

            var listReturned = new List <Table>();

            var mealAllowedRepository = new MealAllowedRepository(mealAllowedAbstraction);

            listReturned.Add(Table.Of("Table-1", "Durant", "Damien", "Meat", mealAllowedRepository.ObtainMealAllowed()));
            listReturned.Add(Table.Of("Table-2", "Lamier", "Lola", "Meat", mealAllowedRepository.ObtainMealAllowed()));
            listReturned.Add(Table.Of("Table-1", "Durant", "Laurent", "Fish", mealAllowedRepository.ObtainMealAllowed()));



            element.ObtainsTheTables().Returns(listReturned);
            var                      tableRepository   = new TableRepository(element);
            List <Table>             tableInformations = tableRepository.ObtainTableList();
            var                      tableInformation  = new TableInformation(tableInformations);
            List <TableMealsNumbers> tableNumberFood   = tableInformation.ObtainMealNumberForAllTheTables(dictionaryMealAllowed);

            Check.That(tableNumberFood.SequenceEqual(tableNumberFoodEstimated) && tableNumberFoodEstimated.SequenceEqual(tableNumberFood)).IsTrue();
        }
Exemplo n.º 3
0
        public void Should_Obtain_Food_Counting_With_The_MealAllowed()
        {
            IList <Table> tableComposition = new List <Table>();

            tableComposition.Add(Table.Of("Table-1", "Durant", "Damien", "Meat", mealAllowed));
            tableComposition.Add(Table.Of("Table-2", "Lamier", "Lola", "Meat", mealAllowed));
            tableComposition.Add(Table.Of("Table-1", "Durant", "Laurent", "Fish", mealAllowed));


            var tableNumberFoodEstimated   = new List <TableMealsNumbers>();
            var mealDicoEstimatedForTable1 = new Dictionary <string, int>();

            mealDicoEstimatedForTable1.Add("Meat", 1);
            mealDicoEstimatedForTable1.Add("Fish", 1);
            tableNumberFoodEstimated.Add(new TableMealsNumbers("Table-1", mealDicoEstimatedForTable1));

            var mealDicoEstimatedForTable2 = new Dictionary <string, int>();

            mealDicoEstimatedForTable2.Add("Meat", 1);
            mealDicoEstimatedForTable2.Add("Fish", 0);

            tableNumberFoodEstimated.Add(new TableMealsNumbers("Table-2", mealDicoEstimatedForTable2));

            var tableInformation = new TableInformation(tableComposition);

            List <TableMealsNumbers> tableNumberFood = tableInformation.ObtainMealNumberForAllTheTables(dictionaryMealAllowed);

            Check.That(tableNumberFood.SequenceEqual(tableNumberFoodEstimated) && tableNumberFoodEstimated.SequenceEqual(tableNumberFood)).IsTrue();
        }