async Task <NetworkStatusTimeline> GetNetworkStatusTimelineAsync(TimeSpan tolerancePeriod) { IAsyncEnumerable <TestOperationResult> store = new StoreTestResultCollection <TestOperationResult>(this.Storage.GetStoreFromSource("networkController"), BatchSize); return(await NetworkStatusTimeline.CreateAsync( store.GetAsyncEnumerator(), tolerancePeriod)); }
public async void TestCreateNetworkStatusTimelineWithEmptyInput( IEnumerable <string> networkControllerResultValues, IEnumerable <DateTime> networkControllerResultDates, IEnumerable <string> networkControllerResultOperations) { var resultCollection = this.GetStoreTestResultCollection(networkControllerResultValues, networkControllerResultDates, networkControllerResultOperations); var ex = await Assert.ThrowsAsync <ArgumentException>(async() => await NetworkStatusTimeline.CreateAsync(resultCollection, new TimeSpan(0, 0, 0, 0, 5))); Assert.Equal("Network Controller Test Results is empty.", ex.Message); }
public async void TestCreateNetworkStatusTimelineWithNoEndRuleSet( IEnumerable <string> networkControllerResultValues, IEnumerable <DateTime> networkControllerResultDates, IEnumerable <string> networkControllerResultOperations) { IAsyncEnumerable <TestOperationResult> resultCollection = this.GetStoreTestResultCollection(networkControllerResultValues, networkControllerResultDates, networkControllerResultOperations); var ex = await Assert.ThrowsAsync <ArgumentException>(async() => await NetworkStatusTimeline.CreateAsync(resultCollection.GetAsyncEnumerator(), new TimeSpan(0, 0, 0, 0, 5))); Assert.Equal("Network Controller Test Results must have an even number of results.", ex.Message); }
public async void TestCreateNetworkStatusTimelineWithMismatchedNetworkStatuses( IEnumerable <string> networkControllerResultValues, IEnumerable <DateTime> networkControllerResultDates, IEnumerable <string> networkControllerResultOperations) { var resultCollection = this.GetStoreTestResultCollection(networkControllerResultValues, networkControllerResultDates, networkControllerResultOperations); NetworkStatusTimeline timeline = await NetworkStatusTimeline.CreateAsync(resultCollection, new TimeSpan(0, 0, 0, 0, 5)); var ex = Assert.Throws <InvalidOperationException>(() => timeline.GetNetworkControllerStatusAndWithinToleranceAt(new DateTime(2020, 1, 1, 9, 10, 16, 10))); Assert.Equal("Test result SettingRule and following RuleSet do not match NetwokControllerStatuses", ex.Message); }
public async void TestCreateNetworkStatusTimelineWithIdenticalConsecutiveOperations( IEnumerable <string> networkControllerResultValues, IEnumerable <DateTime> networkControllerResultDates, IEnumerable <string> networkControllerResultOperations) { var resultCollection = this.GetStoreTestResultCollection(networkControllerResultValues, networkControllerResultDates, networkControllerResultOperations); NetworkStatusTimeline timeline = await NetworkStatusTimeline.CreateAsync(resultCollection, new TimeSpan(0, 0, 0, 0, 5)); var ex = Assert.Throws <InvalidOperationException>(() => timeline.GetNetworkControllerStatusAndWithinToleranceAt(new DateTime(2020, 1, 1, 9, 10, 16, 10))); Assert.Equal("Test result SettingRule found with no RuleSet found after.", ex.Message); }
public async void TestCreateNetworkStatusTimelineWithFirstOperationIncorrect( IEnumerable <string> networkControllerResultValues, IEnumerable <DateTime> networkControllerResultDates, IEnumerable <string> networkControllerResultOperations) { IAsyncEnumerable <TestOperationResult> resultCollection = this.GetStoreTestResultCollection(networkControllerResultValues, networkControllerResultDates, networkControllerResultOperations); NetworkStatusTimeline timeline = await NetworkStatusTimeline.CreateAsync(resultCollection.GetAsyncEnumerator(), new TimeSpan(0, 0, 0, 0, 5)); var ex = Assert.Throws <InvalidOperationException>(() => timeline.GetNetworkControllerStatusAndWithinToleranceAt(new DateTime(2020, 1, 1, 9, 10, 16, 10))); Assert.Equal("Expected SettingRule.", ex.Message); }
public async void TestCreateNetworkStatusTimeline( IEnumerable <string> networkControllerResultValues, IEnumerable <DateTime> networkControllerResultDates, IEnumerable <string> networkControllerResultOperations) { var resultCollection = this.GetStoreTestResultCollection(networkControllerResultValues, networkControllerResultDates, networkControllerResultOperations); NetworkStatusTimeline timeline = await NetworkStatusTimeline.CreateAsync(resultCollection, new TimeSpan(0, 0, 0, 0, 5)); (NetworkControllerStatus status, bool inTolerance) = timeline.GetNetworkControllerStatusAndWithinToleranceAt(new DateTime(2020, 1, 1, 9, 10, 11, 10)); Assert.Equal(NetworkControllerStatus.Disabled, status); Assert.False(inTolerance); (status, inTolerance) = timeline.GetNetworkControllerStatusAndWithinToleranceAt(new DateTime(2020, 1, 1, 9, 10, 16, 10)); Assert.Equal(NetworkControllerStatus.Enabled, status); Assert.False(inTolerance); (status, inTolerance) = timeline.GetNetworkControllerStatusAndWithinToleranceAt(new DateTime(2020, 1, 1, 9, 10, 20, 15)); Assert.Equal(NetworkControllerStatus.Disabled, status); Assert.True(inTolerance); (status, inTolerance) = timeline.GetNetworkControllerStatusAndWithinToleranceAt(new DateTime(2020, 1, 1, 9, 10, 25, 11)); Assert.Equal(NetworkControllerStatus.Enabled, status); Assert.True(inTolerance); (status, inTolerance) = timeline.GetNetworkControllerStatusAndWithinToleranceAt(new DateTime(2020, 1, 1, 9, 10, 25, 12)); Assert.Equal(NetworkControllerStatus.Enabled, status); Assert.True(inTolerance); }
static async Task <NetworkStatusTimeline> GetNetworkStatusTimelineAsync(StoreTestResultCollection <TestOperationResult> results, TimeSpan tolerancePeriod) { return(await NetworkStatusTimeline.CreateAsync(results, tolerancePeriod)); }
static async Task <NetworkStatusTimeline> GetNetworkStatusTimelineAsync(IAsyncEnumerable <TestOperationResult> results, TimeSpan tolerancePeriod) { return(await NetworkStatusTimeline.CreateAsync(results.GetAsyncEnumerator(), tolerancePeriod)); }