public void validate_positive_case_with_two_properties()
        {
            DatabaseDriver.GetFullFastPackContainer().ExecuteInTransaction <IContainer>(c =>
            {
                var session = c.GetInstance <ISession>();
                session.Save(new Case {
                    Identifier = "something",
                    CaseType   = "Open"
                });
                session.Flush();

                var rule    = c.UniqueRuleForProperties <Case>(x => x.Identifier, x => x.CaseType);
                var context = c.ValidationContextFor(new Case {
                    Identifier = "something",
                    CaseType   = "Open"
                });

                rule.ValidateAgainstSession(session, context);

                context.Notification.MessagesFor <Case>(x => x.Identifier).Single()
                .StringToken.ShouldEqual(FastPackKeys.FIELD_MUST_BE_UNIQUE);

                context.Notification.MessagesFor <Case>(x => x.CaseType).Single()
                .StringToken.ShouldEqual(FastPackKeys.FIELD_MUST_BE_UNIQUE);
            });
        }
Exemple #2
0
 public void SetUp()
 {
     container = DatabaseDriver.GetFullFastPackContainer();
     container.Configure(x =>
     {
         x.UseOnDemandNHibernateTransactionBoundary();
     });
 }
Exemple #3
0
        public void try_to_build_out_the_test_harness_case_grid()
        {
            var container = DatabaseDriver.GetFullFastPackContainer();

            container.ExecuteInTransaction <CaseController>(x =>
            {
                Debug.WriteLine(x.AllCases().ToString());
            });
        }
Exemple #4
0
        public void try_to_build_out_the_test_harness_case_grid()
        {
            var container = DatabaseDriver.GetFullFastPackContainer();

            container.Configure(x => x.For <ICurrentHttpRequest>().Use <FakeCurrentHttpRequest>());
            container.ExecuteInTransaction <CaseController>(x =>
            {
                Debug.WriteLine(x.AllCases().ToString());
            });
        }
Exemple #5
0
        public void SetUp()
        {
            requestData = new InMemoryRequestData();

            container = DatabaseDriver.GetFullFastPackContainer();
            container.Configure(x =>
            {
                x.UseOnDemandNHibernateTransactionBoundary();
                x.For <IRequestData>().Use(requestData);
            });
        }
Exemple #6
0
        protected void beforeEach()
        {
            DatabaseDriver.GetFullFastPackContainer();

            using (var container = DatabaseDriver.ContainerWithDatabase())
            {
                container.Configure(x => x.UseOnDemandNHibernateTransactionBoundary());
                var session = container.GetInstance <ISession>();
                xxx(session, container);
            }
        }
        public void validate_negative_case()
        {
            using (var container = DatabaseDriver.GetFullFastPackContainer().GetNestedContainer())
            {
                container.Configure(x => x.UseOnDemandNHibernateTransactionBoundary());

                var rule    = container.UniqueRuleForProperties <Site>(x => x.Name);
                var context = container.ValidationContextFor(new Site {
                    Name = "something"
                });
                rule.Validate(context);

                context.Notification.IsValid().ShouldBeTrue();
            }
        }
        public void validate_negative_case_with_two_properties()
        {
            DatabaseDriver.GetFullFastPackContainer().ExecuteInTransaction <IContainer>(c =>
            {
                var session = c.GetInstance <ISession>();
                session.Save(new Case {
                    Identifier = "something", CaseType = "Open"
                });
                session.Flush();

                var rule    = c.UniqueRuleForProperties <Case>(x => x.Identifier, x => x.CaseType);
                var context = c.ValidationContextFor(new Case
                {
                    Identifier = "something",
                    CaseType   = "different"
                });

                rule.ValidateAgainstSession(session, context);

                context.Notification.IsValid().ShouldBeTrue();
            });
        }