public void Setup()
        {
            messages = new List <MailMessage>();
            ForTest.InitializeMailer();
            var mailer = ForTest.TestMailer(m => messages.Add(m));

            task = new SendInvoiceTask(mailer);
        }
Example #2
0
        public void Setup()
        {
            var promotionsToClean = session.Query <SupplierPromotion>().ToList();

            session.DeleteEach(promotionsToClean);
            Flush();
            messages = new List <MailMessage>();
            ForTest.InitializeMailer();
        }
Example #3
0
 public void SetUp()
 {
     ForTest.InitializeMailer();
     message = null;
     news    = new News {
         Header          = "TestNewHeader",
         Body            = "TestNewsBody",
         PublicationDate = DateTime.Now
     };
     Save(news);
 }
Example #4
0
        public void ControllerSetup()
        {
            DataMother = new DataMother(session);
            ForTest.InitializeMailer();
            controller           = new BuilderController();
            controller.DbSession = session;
            var context = new StubContext();

            context.StubRequest.StubHttpMethod = "POST";
            controller.ControllerContext       = new ControllerContext(context, new RouteData(), controller);
            controller.ValueProvider           = new FormCollection().ToValueProvider();
        }
Example #5
0
        public void Name_change_one_mail()
        {
            ForTest.InitializeMailer();
            var messages = new List <MailMessage>();

            ChangeNotificationSender.Sender    = ForTest.CreateStubSender(m => messages.Add(m));
            ChangeNotificationSender.UnderTest = true;

            client.Name += "123";
            session.Save(client);
            Flush();

            Assert.That(messages.Count, Is.EqualTo(1));
        }
Example #6
0
        private Act PrepareAct()
        {
            ForTest.InitializeMailer();
            var act = new Act {
                Date      = new DateTime(2012, 11, 13),
                Recipient = session.Query <Recipient>().First(),
                Customer  = "Организация",
                Period    = new Period(2012, Interval.January),
                Sum       = 100
            };

            session.Save(act);
            return(act);
        }
        public void Notify_about_work_region_mask_changes()
        {
            ForTest.InitializeMailer();
            MailMessage message = null;

            ChangeNotificationSender.Sender    = ForTest.CreateStubSender(m => message = m);
            ChangeNotificationSender.UnderTest = true;

            Reopen();
            user = session.Load <User>(user.Id);
            user.WorkRegionMask = 3;
            Save(user);
            Close();

            Assert.That(message, Is.Not.Null);
            Assert.That(message.Body, Is.StringEnding(String.Format("Код пользователя {0}\r\n"
                                                                    + "Пользователь {1}\r\n"
                                                                    + "Клиент {2}\r\n"
                                                                    + "Изменено 'Регионы работы' Добавлено 'Белгород'\r\n", user.Id, user.Name, client.Name)));
            Assert.That(message.To[0].ToString(), Is.EqualTo("*****@*****.**"));
            Assert.That(message.Subject, Is.EqualTo("Изменено поле 'Регионы работы'"));
        }
Example #8
0
        public void Setup()
        {
            message    = null;
            controller = new RegisterController();

            PrepareController(controller, "Registered");
            ((StubRequest)Request).Uri             = new Uri("https://stat.analit.net/adm/Register/Register");
            ((StubRequest)Request).ApplicationPath = "/Adm";

            ForTest.InitializeMailer();
            mailer = ForTest.TestMailer(m => message = m);

            payer = new Payer("Тестовый плательщик")
            {
                Id = 10, JuridicalName = "FullTestPayerName"
            };
            client = new Client(payer, Data.DefaultRegion)
            {
                Id         = 58,
                Name       = "Тестовый клиент",
                HomeRegion = new Region {
                    Name = "test"
                },
                Settings = new DrugstoreSettings()
            };
            supplier = new Supplier {
                Name       = "Тестовый поставщик",
                HomeRegion = new Region {
                    Name = "testSupplierRegion"
                }
            };
            payer.Clients.Add(client);
            payer.Suppliers.Add(supplier);
            user = new User(payer, client);
            client.Users.Add(user);
        }
Example #9
0
 public void Setup()
 {
     ForTest.InitializeMailer();
     mailer  = ForTest.TestMailer(m => { });
     _client = DataMother.CreateTestClientWithUser();
 }