/// <summary> /// Henter en given kalenderaftale fra et system under OSWEBDB. /// </summary> /// <param name="system">Unik identifikation af systemet under OSWEBDB.</param> /// <param name="id">Unik identifikation af kalenderaftalen.</param> /// <returns>Kalenderaftale.</returns> public IAftale AftaleGetBySystemAndId(int system, int id) { try { AftaleProxy queryForAftale = new AftaleProxy(system, id); return(_mySqlDataProvider.Get(queryForAftale)); } catch (IntranetRepositoryException) { throw; } catch (Exception ex) { throw new IntranetRepositoryException(Resource.GetExceptionMessage(ExceptionMessage.RepositoryError, MethodBase.GetCurrentMethod().Name, ex.Message), ex); } }
public void TestAtGetHenterDataProxy() { using (IMySqlDataProvider sut = CreateSut()) { Assert.That(sut, Is.Not.Null); MyDataProxy result = sut.Get(new MyDataProxy { SystemNo = 1 }); Assert.That(result, Is.Not.Null); Assert.That(result.SystemNo, Is.EqualTo(1)); Assert.That(result.Title, Is.Not.Null); Assert.That(result.Title.Length, Is.GreaterThan(0)); Assert.That(result.MapDataIsCalled, Is.True); Assert.That(result.MapRelationsIsCalled, Is.True); } }
public void TestAtGetKasterIntranetRepositoryExceptionHvisIdIkkeFindes() { using (IMySqlDataProvider sut = CreateSut()) { Assert.That(sut, Is.Not.Null); int systemNo = _random.Next(1, 9) * -1; MyDataProxy queryForDataProxy = new MyDataProxy { SystemNo = systemNo }; IntranetRepositoryException result = Assert.Throws <IntranetRepositoryException>(() => sut.Get(queryForDataProxy)); TestHelper.AssertIntranetRepositoryExceptionIsValid(result, ExceptionMessage.CantFindObjectById, queryForDataProxy.GetType().Name, systemNo); } }
public void TestAtGetKasterArgumenutNullExceptionHvisDataProxyErNull() { using (IMySqlDataProvider sut = CreateSut()) { Assert.That(sut, Is.Not.Null); ArgumentNullException result = Assert.Throws <ArgumentNullException>(() => sut.Get <MyDataProxy>(null)); TestHelper.AssertArgumentNullExceptionIsValid(result, "dataProxy"); } }