示例#1
0
        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.Create(resultCollection, new TimeSpan(0, 0, 0, 0, 5)));

            Assert.Equal("Network Controller Test Results is empty.", ex.Message);
        }
示例#2
0
        public async void TestCreateNetworkStatusTimelineWithMismatchedNetworkStatuses(
            IEnumerable <string> networkControllerResultValues,
            IEnumerable <DateTime> networkControllerResultDates,
            IEnumerable <string> networkControllerResultOperations)
        {
            var resultCollection           = this.GetStoreTestResultCollection(networkControllerResultValues, networkControllerResultDates, networkControllerResultOperations);
            NetworkStatusTimeline timeline = await NetworkStatusTimeline.Create(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);
        }
示例#3
0
        public async void TestCreateNetworkStatusTimelineWithIdenticalConsecutiveOperations(
            IEnumerable <string> networkControllerResultValues,
            IEnumerable <DateTime> networkControllerResultDates,
            IEnumerable <string> networkControllerResultOperations)
        {
            var resultCollection           = this.GetStoreTestResultCollection(networkControllerResultValues, networkControllerResultDates, networkControllerResultOperations);
            NetworkStatusTimeline timeline = await NetworkStatusTimeline.Create(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);
        }
示例#4
0
        public async void TestCreateNetworkStatusTimeline(
            IEnumerable <string> networkControllerResultValues,
            IEnumerable <DateTime> networkControllerResultDates,
            IEnumerable <string> networkControllerResultOperations)
        {
            var resultCollection           = this.GetStoreTestResultCollection(networkControllerResultValues, networkControllerResultDates, networkControllerResultOperations);
            NetworkStatusTimeline timeline = await NetworkStatusTimeline.Create(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);
        }