diff --git a/Sources/VaporTestTools/Extensions/Services/Services+Testing.swift b/Sources/VaporTestTools/Extensions/Services/Services+Testing.swift new file mode 100644 index 0000000..7b8f68d --- /dev/null +++ b/Sources/VaporTestTools/Extensions/Services/Services+Testing.swift @@ -0,0 +1,24 @@ +// +// Services+Testing.swift +// VaporTestTools +// +// Created by Ondrej Rafaj on 20/03/2018. +// + +import Foundation +@testable import Service + + +extension TestableProperty where TestableType == Services { + + public mutating func remove(type: S.Type) { + if let existing = element.factories.index(where: { + $0.serviceType is S.Type + }) { + element.factories.remove(at: existing) + } + } + +} + + diff --git a/Sources/VaporTestTools/Properties/TestableProperty.swift b/Sources/VaporTestTools/Properties/TestableProperty.swift index 158c231..fb18801 100644 --- a/Sources/VaporTestTools/Properties/TestableProperty.swift +++ b/Sources/VaporTestTools/Properties/TestableProperty.swift @@ -10,7 +10,7 @@ import Foundation public struct TestableProperty { - public let element: TestableType + public var element: TestableType init(_ obj: TestableType) { element = obj diff --git a/Sources/VaporTestTools/TestTools.swift b/Sources/VaporTestTools/TestTools.swift index 0c18cab..2b994a0 100644 --- a/Sources/VaporTestTools/TestTools.swift +++ b/Sources/VaporTestTools/TestTools.swift @@ -36,6 +36,7 @@ extension Request: Testable { } extension HTTPRequest: Testable { } extension Response: Testable { } extension Application: Testable { } +extension Services: Testable { } extension Dictionary: Testable where Key == String, Value == String {