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

            worksId.Add(3);

            var model = new MailingsGeneratorDomain.Models.Mailing()
            {
                StartDate    = "10.01",
                WorksId      = worksId,
                FinishWorkId = 3,
                MailingId    = 14,
                CourseName   = "course1"
            };

            //act
            var m = await _service.CreateMailingAsync(model);

            // assert
            // Assert.AreEqual("lab 2", ce.Name);
            Assert.IsTrue(_mailingsDb.ContainsKey(m.MailingId));
            Assert.IsTrue(_mailingsDb[m.MailingId].MailText.Count >= _mailingsDb[m.MailingId].Works.Count);
            Assert.IsTrue(_mailingsDb[m.MailingId].Works.Count == worksId.Count);
            Assert.IsTrue(_mailingsDb.ContainsValue(m));
        }