public (bool isAvailable, FailedReason reason) IsAvailable()
        {
            (bool isAvailable, DatabaseFailedReason reason) =
                statsDownloadDatabaseService.IsAvailable(Constants.FileDownloadDatabase.FileDownloadObjects);

            FailedReason failedReason;

            if (reason == DatabaseFailedReason.None)
            {
                failedReason = FailedReason.None;
            }
            else if (reason == DatabaseFailedReason.DatabaseUnavailable)
            {
                failedReason = FailedReason.DatabaseUnavailable;
            }
            else if (reason == DatabaseFailedReason.DatabaseMissingRequiredObjects)
            {
                failedReason = FailedReason.DatabaseMissingRequiredObjects;
            }
            else
            {
                throw new ArgumentOutOfRangeException();
            }

            return(isAvailable, failedReason);
        }
示例#2
0
        public void IsAvailable_WhenInvoked_ReturnsIsAvailable(bool expectedIsAvailable,
                                                               DatabaseFailedReason expectedReason)
        {
            statsDownloadDatabaseServiceMock.IsAvailable(Constants.StatsDownloadApiDatabase.ApiObjects)
            .Returns((expectedIsAvailable, expectedReason));

            (bool isAvailable, DatabaseFailedReason reason)actual = systemUnderTest.IsAvailable();

            Assert.That(actual.isAvailable, Is.EqualTo(expectedIsAvailable));
            Assert.That(actual.reason, Is.EqualTo(expectedReason));
        }
        public void IsAvailable_WhenInvoked_ReturnsDatabaseAvailability(bool expectedIsAvailable,
                                                                        DatabaseFailedReason failedReason,
                                                                        FailedReason expectedReason)
        {
            statsDownloadDatabaseServiceMock.IsAvailable(Constants.FileDownloadDatabase.FileDownloadObjects)
            .Returns((expectedIsAvailable, failedReason));

            (bool isAvailable, FailedReason reason)actual = InvokeIsAvailable();

            Assert.That(actual.isAvailable, Is.EqualTo(expectedIsAvailable));
            Assert.That(actual.reason, Is.EqualTo(expectedReason));
        }
 private (bool isAvailable, DatabaseFailedReason reason) InvokeIsAvailable(string[] requiredObjects = null)
 {
     return(systemUnderTest.IsAvailable(requiredObjects));
 }
 public (bool isAvailable, DatabaseFailedReason reason) IsAvailable()
 {
     return(statsDownloadDatabaseService.IsAvailable(Constants.StatsDownloadApiDatabase.ApiObjects));
 }