public void ShouldThrowExceptionWhenTryingToSaveInherited1WithDuplicateName()
		{
			using (var session = OpenSession())
			using (var transaction = session.BeginTransaction())
			{
				var e1 = new Inherited1 { Name = "Bob" };
				session.Save(e1);

				Assert.That(() => { transaction.Commit(); }, Throws.Exception);
			}
		}
Exemplo n.º 2
0
        public void ShouldThrowExceptionWhenTryingToSaveInherited1WithDuplicateName()
        {
            using (var session = OpenSession())
                using (var transaction = session.BeginTransaction())
                {
                    var e1 = new Inherited1 {
                        Name = "Bob"
                    };
                    session.Save(e1);

                    Assert.That(() => { transaction.Commit(); }, Throws.Exception);
                }
        }
Exemplo n.º 3
0
        public async Task ShouldThrowExceptionWhenTryingToSaveInherited1WithDuplicateNameAsync()
        {
            using (var session = OpenSession())
                using (var transaction = session.BeginTransaction())
                {
                    var e1 = new Inherited1 {
                        Name = "Bob"
                    };
                    await(session.SaveAsync(e1));

                    // Do not use bare Throws.Exception due to https://github.com/nunit/nunit/issues/1899
                    Assert.That(() => { return(transaction.CommitAsync()); }, Throws.InstanceOf <Exception>());
                }
        }
		protected override void OnSetUp()
		{
			using (var session = OpenSession())
			using (var transaction = session.BeginTransaction())
			{
				var e1 = new Inherited1 { Name = "Bob" };
				session.Save(e1);

				var e2 = new Inherited2 { Name = "Sally" };
				session.Save(e2);

				session.Flush();
				transaction.Commit();
			}
		}
Exemplo n.º 5
0
        protected override void OnSetUp()
        {
            using (var session = OpenSession())
                using (var transaction = session.BeginTransaction())
                {
                    var e1 = new Inherited1 {
                        Name = "Bob"
                    };
                    session.Save(e1);

                    var e2 = new Inherited2 {
                        Name = "Sally"
                    };
                    session.Save(e2);

                    session.Flush();
                    transaction.Commit();
                }
        }