public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { TestErrors mask = (TestErrors)parameter; this.target = (TestErrors)value; return((mask & this.target) != 0); }
/// <summary> /// Creates a set of test descriptors with interesting error payloads. /// </summary> /// <param name="settings">The test descriptor settings to use.</param> /// <returns>List of test descriptors with interesting errors as payload.</returns> internal static IEnumerable <PayloadReaderTestDescriptor> CreateErrorReaderTestDescriptors(PayloadReaderTestDescriptor.Settings settings) { return(TestErrors.CreateErrorTestDescriptors().Select(err => new PayloadReaderTestDescriptor(settings) { PayloadElement = err.PayloadElement, SkipTestConfiguration = tc => tc.IsRequest })); }
public void GatherStatistics(Network network) { double averageError = 0; foreach (var testElement in TestElements) { var output = network.ForwardPropagation(testElement.Input); var error = Network.MeanSquaredError(output, testElement.DesiredOutput); averageError += error; } averageError /= TestElements.Count; TestErrors.Add(averageError); }
public void GatherStatistics(Network network) { double averageError = 0; double positiveV = 0; double positiveT = 0; //GET COUNT POSITIVES FOR TESTING SET foreach (var testElement in TestElements) { var output = network.ForwardPropagation(testElement.Input); int guessedClass = ConvertMatrixToClass(output); int rightClass = ConvertMatrixToClass(testElement.DesiredOutput); if (guessedClass == rightClass) { positiveV++; } var error = Network.MeanSquaredError(output, testElement.DesiredOutput); averageError += error; } AccuracyListV.Add(positiveV / TestElements.Count); averageError /= TestElements.Count; TestErrors.Add(averageError); //GET COUNT POSITIVES FOR TRAINING SET foreach (var trainElement in TrainingElements) { var output = network.ForwardPropagation(trainElement.Input); int guessedClass = ConvertMatrixToClass(output); int rightClass = ConvertMatrixToClass(trainElement.DesiredOutput); if (guessedClass == rightClass) { positiveT++; } } AccuracyListT.Add(positiveT / TrainingElements.Count); }
public void IF_OnFailure_is_given_and_task_returns_correct_fail_SHOULD_handle_and_reset_IsExecuting() { //Arrange Error result = default; Sut.OnFailure(TestErrors.Fail(), x => { result = x; return(Task.CompletedTask); }); _result = Response.Failure(TestErrors.Fail()); using (var isExecutingChanges = Sut.SubscribeToPropertyChanged(x => x.IsExecuting)) { //Act Sut.Execute(); isExecutingChanges.WaitForChangeCount(2); //Assert Assert.That(result == TestErrors.Fail()); Assert.AreEqual(false, Sut.IsExecuting); MockErrorHandler.Verify_HandleErrorMessage_not_called(); } }
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { this.target ^= (TestErrors)parameter; return(this.target); }