Esempio n. 1
0
        public async Task UpdateMailingAsync_UpdatesDataBase()
        {
            //arrange
            var worksId = new List <int>();

            worksId.Add(5);

            var oldWorkCount = _mailingsDb[1].Works.Count;
            var oldTextCount = _mailingsDb[1].MailText.Count;

            var model = new UpdateMailingModel()
            {
                MailingId = 1,
                StartDate = "10.01",
                WorksId   = worksId
            };

            //act
            await _service.UpdateAsync(model);

            // assert
            Assert.AreEqual("10.01", _mailingsDb[1].StartDate);
            Assert.IsTrue(_mailingsDb[1].Works.Count > oldWorkCount);
            Assert.IsTrue(_mailingsDb[1].MailText.Count > oldTextCount);
        }