public void Product_ActiveCannotBeActivated()
        {
            var product = TestProductFactory.Travel();

            var ex = Assert.Throws <ApplicationException>(() => product.Activate());

            Assert.Equal("Only draft version can be modified and activated", ex.Message);
        }
        public void Product_DraftCanBeActivated()
        {
            var product = TestProductFactory.InactiveTravel();

            product.Activate();

            Assert.Equal(ProductStatus.Active, product.Status);
        }
        public async Task FindProductByCodeHandler_ReturnsOneProduct()
        {
            var findProductByCodeHandler = new FindProductByCodeHandler(productRepository.Object);

            var result = await findProductByCodeHandler.Handle(new Api.Queries.FindProductByCodeQuery {
                ProductCode = TestProductFactory.Travel().Code
            }, new System.Threading.CancellationToken());

            Assert.NotNull(result);
        }
        public void Product_CoverIsAdded(string code, string name, string description, bool optional, decimal?sumInsured)
        {
            var product = TestProductFactory.EmptyTravel();

            product.AddCover(code, name, description, optional, sumInsured);

            Assert.NotEmpty(product.Covers);
            Assert.Single(product.Covers);
            Assert.NotEqual(Guid.Empty, product.Covers.First().Id);
        }
        public void Product_QuestionsAreAdded()
        {
            var product = TestProductFactory.EmptyTravel();

            var testQuestions = new List <Question>
            {
                TestQuestionFactory.ChoiceQuestion(),
                TestQuestionFactory.DateQuestion(),
                TestQuestionFactory.NumericQuestion()
            };

            product.AddQuestions(testQuestions);

            Assert.NotEmpty(product.Questions);
            Assert.Equal(testQuestions.Count, product.Questions.Count);
            Assert.All(product.Questions, item => Assert.NotEqual(Guid.Empty, item.Id));
        }