예제 #1
0
        public void CreateQuoteWithMissingContent_ShouldThrow()
        {
            var quote = TestObjectFactory.CreateQuote();

            quote.Content = null;
            this.ValidateEntity(quote);
        }
        public void Init()
        {
            this.quoteTestObject = TestObjectFactory.CreateQuote();
            quoteTestObject.Id   = 1;

            var quoteTestData = new List <Quote>();

            quoteTestData.Add(this.quoteTestObject);

            this.quoteRepository = TestObjectFactory.CreateRepository(quoteTestData);

            this.service = new QuotesService(this.quoteRepository);
        }
        public void TestQuote_ShouldAddEntityToDbSetAndDbCorrectly()
        {
            QuoteQuizContext dbContext = new QuoteQuizContext();

            var quote = TestObjectFactory.CreateQuote();

            dbContext.Quotes.Add(quote);
            dbContext.SaveChanges();

            var quoteInDb = dbContext.Quotes.Find(quote.Id);

            Assert.IsNotNull(quoteInDb);
            Assert.AreEqual(quoteInDb.Content, quote.Content);
            Assert.AreEqual(quoteInDb.Author, quote.Author);
        }