Example #1
0
        public void TestAtSaveGemmerDataProxy()
        {
            using (IMySqlDataProvider sut = CreateSut())
            {
                Assert.That(sut, Is.Not.Null);

                int         systemNo       = _random.Next(90, 99);
                MyDataProxy mySqlDataProxy = _fixture.Build <MyDataProxy>()
                                             .With(m => m.SystemNo, systemNo)
                                             .Create();
                Assert.That(mySqlDataProxy, Is.Not.Null);
                Assert.That(mySqlDataProxy.SaveRelationsIsCalled, Is.False);

                MyDataProxy result = sut.Add(mySqlDataProxy);
                Assert.That(result, Is.Not.Null);
                Assert.That(result.SaveRelationsIsCalled, Is.True);
                Assert.That(result.IsInserting, Is.True);

                result = sut.Save(mySqlDataProxy);
                Assert.That(result, Is.Not.Null);
                Assert.That(result.SaveRelationsIsCalled, Is.True);
                Assert.That(result.IsInserting, Is.False);

                sut.Delete(result);
            }
        }
Example #2
0
        public void TestAtAddKasterMySqlExceptionHvisDataProxyFindes()
        {
            using (IMySqlDataProvider sut = CreateSut())
            {
                Assert.That(sut, Is.Not.Null);

                int         systemNo       = _random.Next(90, 99);
                MyDataProxy mySqlDataProxy = _fixture.Build <MyDataProxy>()
                                             .With(m => m.SystemNo, systemNo)
                                             .Create();
                Assert.That(mySqlDataProxy, Is.Not.Null);

                MyDataProxy result = sut.Add(mySqlDataProxy);
                Assert.That(result, Is.Not.Null);

                Assert.Throws <MySqlException>(() => sut.Add(mySqlDataProxy));

                sut.Delete(result);
            }
        }
Example #3
0
        public void TestAtAddKasterArgumenutNullExceptionHvisDataProxyErNull()
        {
            using (IMySqlDataProvider sut = CreateSut())
            {
                Assert.That(sut, Is.Not.Null);

                ArgumentNullException result = Assert.Throws <ArgumentNullException>(() => sut.Add <MyDataProxy>(null));

                TestHelper.AssertArgumentNullExceptionIsValid(result, "dataProxy");
            }
        }