コード例 #1
0
ファイル: CountryTests.cs プロジェクト: whesius/allors
        public void GivenCountryWhenValidatingThenRequiredRelationsMustExist()
        {
            var builder = new CountryBuilder(this.DatabaseSession);
            builder.Build();

            Assert.IsTrue(this.DatabaseSession.Derive().HasErrors);

            builder.WithIsoCode("XX").Build();
            builder.Build();

            Assert.IsTrue(this.DatabaseSession.Derive().HasErrors);

            this.DatabaseSession.Rollback();

            builder.WithName("X Country");

            builder.Build();

            Assert.IsFalse(this.DatabaseSession.Derive().HasErrors);

            this.DatabaseSession.Rollback();

            builder = new CountryBuilder(this.DatabaseSession);
            builder.WithName("X Country");

            builder.Build();

            Assert.IsTrue(this.DatabaseSession.Derive().HasErrors);
        }
コード例 #2
0
        public void GivenCountryWhenValidatingThenRequiredRelationsMustExist()
        {
            var builder = new CountryBuilder(this.Session);

            builder.Build();

            Assert.IsTrue(this.Session.Derive().HasErrors);

            builder.WithIsoCode("XX").Build();
            builder.Build();

            Assert.IsTrue(this.Session.Derive().HasErrors);

            this.Session.Rollback();

            builder.WithName("X Country");

            builder.Build();

            Assert.IsFalse(this.Session.Derive().HasErrors);

            this.Session.Rollback();

            builder = new CountryBuilder(this.Session);
            builder.WithName("X Country");

            builder.Build();

            Assert.IsTrue(this.Session.Derive().HasErrors);
        }
コード例 #3
0
        public void TheBuilderPatternShouldReturnADefaultObjectIfNoValuesAreProvided()
        {
            var country = _builder.Build();

            Assert.AreEqual("Default", country.Name);
            Assert.AreEqual("Default", country.Continent.Name);
            Assert.AreEqual("Default", country.Currency);
            Assert.AreEqual("Default", country.Language);
        }