Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 3
0
        public void TestAtDeleteKasterArgumenutNullExceptionHvisDataProxyErNull()
        {
            using (IMySqlDataProvider sut = CreateSut())
            {
                Assert.That(sut, Is.Not.Null);

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

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