示例#1
0
        public void TestQuoteServices_GetQuoteItemModel(string testValue)
        {
            if (testValue == "HasQuoteItemId")
            {
                //get the QuoteItemId
                var quoteItemId = this.db.Context.QuoteItems.Where(qi => qi.QuoteId == _quoteId)
                                  .OrderByDescending(qi => qi.QuoteItemId)
                                  .Select(qi => qi.QuoteItemId)
                                  .FirstOrDefault();

                this.Response = quoteService.GetQuoteItemModel(user, _quoteId, quoteItemId);
                Assert.That(this.Response.HasError, Is.EqualTo(false));

                QuoteItemModel model = this.Response.Model as QuoteItemModel;
                Assert.That(model, Is.Not.EqualTo(null));
                Assert.That(model.QuoteItemId, Is.EqualTo(_quoteId));
                Assert.That(model.QuoteId, Is.EqualTo(_quoteId));

                //make sure the model has Quote
                Assert.That(model.Quote, Is.Not.EqualTo(null));
            }
            else
            {
                this.Response = quoteService.GetQuoteItemModel(user, _quoteId, 123456);
                Assert.That(this.Response.HasError, Is.EqualTo(true));
                Assert.That(this.Response.Messages.Items.Any(m => m.Text.Contains(Resources.DataMessages.DM023)), Is.EqualTo(true));
            }
        }