예제 #1
0
        public void GivenBricksburgLocation_WhenAskingForMiniSizePizza_ThenItShouldReturnCorrectValue()
        {
            // arrange
            Order order = new Order
            {
                Location = "Bricksburg",
                Products = new[]
                {
                    new ProductRequest
                    {
                        Name        = "Pizza",
                        Size        = "Personal",
                        Ingredients = new []
                        {
                            "Mushrooms"
                        }
                    }
                }
            };

            // act
            Invoice invoice = order.Invoice();

            // assert
            Privateer       privateer = new Privateer();
            List <LineItem> lineItems = privateer.Field <List <LineItem> >(invoice, "_lineItems");

            lineItems.Should().HaveCount(1);
            privateer.Field <string>(lineItems[0], "_description").Should().Be("Personal Pizza with Mushrooms");
            privateer.Field <string>(lineItems[0], "_price").Should().Be("17,33 &");
        }
예제 #2
0
        public void GivenSpringfieldLocation_WhenAskingForMiniSizePizzaWithCrispyHam_ThenItShouldReturnCorrectValue()
        {
            // arrange
            Order order = new Order
            {
                Location = "Springfield",
                Products = new[]
                {
                    new ProductRequest
                    {
                        Name        = "Pizza",
                        Size        = "Mini",
                        Ingredients = new []
                        {
                            "Crispy Ham"
                        }
                    }
                }
            };

            // act
            Invoice invoice = order.Invoice();

            // assert
            Privateer       privateer = new Privateer();
            List <LineItem> lineItems = privateer.Field <List <LineItem> >(invoice, "_lineItems");

            lineItems.Should().HaveCount(1);
            privateer.Field <string>(lineItems[0], "_description").Should().Be("Mini Pizza with Crispy Ham");
            privateer.Field <string>(lineItems[0], "_price").Should().Be("$10.35");
        }
예제 #3
0
        public void GivenPersonalSizePizza_WhenAskingForInvoice_ThenItShouldReturnCorrectInvoice()
        {
            // arrange
            Order order = new Order
            {
                Location = "Bedrock",
                Products = new []
                {
                    new ProductRequest
                    {
                        Name        = "Pizza",
                        Size        = "Personal",
                        Ingredients = new []
                        {
                            "Mushrooms",
                            "Pepperoni"
                        }
                    }
                }
            };

            // act
            Invoice invoice = order.Invoice();

            // assert
            Privateer       privateer = new Privateer();
            List <LineItem> lineItems = privateer.Field <List <LineItem> >(invoice, "_lineItems");

            lineItems.Should().HaveCount(1);
            privateer.Field <string>(lineItems[0], "_description").Should().Be("Personal Pizza with Mushrooms and Pepperoni");
            privateer.Field <string>(lineItems[0], "_price").Should().Be("$11.25");
        }
예제 #4
0
        public void GivenBricksburgLocationPersonalSizePizzaAndChangedIngredients_WhenAskingForInvoice_ThenItShouldReturnCorrectInvoice()
        {
            // arrange
            Order order = new Order
            {
                Location = "Bricksburg",
                Products = new []
                {
                    new ProductRequest
                    {
                        Name        = "Pizza",
                        Size        = "Personal",
                        Ingredients = new []
                        {
                            "Mushrooms",
                            "Pepperoni"
                        }
                    }
                }
            };

            order.Products = new[]
            {
                new ProductRequest
                {
                    Name        = "Pizza",
                    Size        = "Personal",
                    Ingredients = new[]
                    {
                        "Pepperoni"
                    }
                }
            };

            // act
            Invoice invoice = order.Invoice();

            // assert
            Privateer       privateer = new Privateer();
            List <LineItem> lineItems = privateer.Field <List <LineItem> >(invoice, "_lineItems");

            lineItems.Should().HaveCount(1);
            privateer.Field <string>(lineItems[0], "_description").Should().Be("Personal Pizza with Pepperoni");
            privateer.Field <string>(lineItems[0], "_price").Should().Be("18,11 &");

            string serializedInvoice = JsonConvert.SerializeObject(invoice);
        }
예제 #5
0
        public void GivenHalfSizeCalzoneWithChangedSizeAndIngredients_WhenAskingForInvoice_ThenItShouldReturnCorrectInvoice()
        {
            // arrange
            Order order = new Order
            {
                Location = "Bedrock",
                Products = new[]
                {
                    new ProductRequest
                    {
                        Name        = "Calzone",
                        Size        = "Half-Size",
                        Ingredients = new []
                        {
                            "Mushrooms",
                            "Pepperoni"
                        }
                    }
                }
            };

            order.Products = new[]
            {
                new ProductRequest
                {
                    Name        = "Calzone",
                    Size        = "Full",
                    Ingredients = new[]
                    {
                        "Pepperoni"
                    }
                }
            };

            // act
            Invoice invoice = order.Invoice();

            // assert
            Privateer       privateer = new Privateer();
            List <LineItem> lineItems = privateer.Field <List <LineItem> >(invoice, "_lineItems");

            lineItems.Should().HaveCount(1);
            privateer.Field <string>(lineItems[0], "_description").Should().Be("Full Calzone with Pepperoni");
            privateer.Field <string>(lineItems[0], "_price").Should().Be("$16.10");
        }