1+ import AppKit
12import DataLayer
23import os
3- import XCTest
4+ import Testing
45
56@testable import Domain
67
7- final class ShiftServiceTests : XCTestCase {
8- func test_getValidFrame_MainScreenが取得不能_nilが返される( ) async {
8+ struct ShiftServiceTests {
9+ @Test
10+ func getValidFrame_MainScreenが取得不能_nilが返される( ) async {
911 let sut = ShiftService ( . testValue, . testValue, . testValue, . testValue, . testValue)
1012 let actual = await sut. getValidFrame ( )
11- XCTAssertNil ( actual)
13+ #expect ( actual == nil )
1214 }
1315
14- func test_getValidFrame_MainScreenが取得可能_Dockが下部に存在_有効領域が返される( ) async {
16+ @Test
17+ func getValidFrame_MainScreenが取得可能_Dockが下部に存在_有効領域が返される( ) async {
1518 let nsScreenClient = testDependency ( of: NSScreenClient . self) {
1619 $0. mainScreen = { NSScreenMock ( x: 0 , y: 0 , width: 100 , height: 95 ) }
1720 }
@@ -23,10 +26,11 @@ final class ShiftServiceTests: XCTestCase {
2326 }
2427 let sut = ShiftService ( cgDirectDisplayClient, . testValue, nsAppClient, nsScreenClient, . testValue)
2528 let actual = await sut. getValidFrame ( )
26- XCTAssertEqual ( actual, CGRect ( x: 0 , y: 5 , width: 100 , height: 95 ) )
29+ #expect ( actual == CGRect ( x: 0 , y: 5 , width: 100 , height: 95 ) )
2730 }
2831
29- func test_getValidFrame_MainScreenが取得可能_Dockが右側に存在_有効領域が返される( ) async {
32+ @Test
33+ func getValidFrame_MainScreenが取得可能_Dockが右側に存在_有効領域が返される( ) async {
3034 let nsScreenClient = testDependency ( of: NSScreenClient . self) {
3135 $0. mainScreen = { NSScreenMock ( x: 0 , y: 0 , width: 95 , height: 95 ) }
3236 }
@@ -38,10 +42,11 @@ final class ShiftServiceTests: XCTestCase {
3842 }
3943 let sut = ShiftService ( cgDirectDisplayClient, . testValue, nsAppClient, nsScreenClient, . testValue)
4044 let actual = await sut. getValidFrame ( )
41- XCTAssertEqual ( actual, CGRect ( x: 0 , y: 5 , width: 94 , height: 95 ) )
45+ #expect ( actual == CGRect ( x: 0 , y: 5 , width: 94 , height: 95 ) )
4246 }
4347
44- func test_getValidFrame_MainScreenが取得可能_Dockが左側に存在_有効領域が返される( ) async {
48+ @Test
49+ func getValidFrame_MainScreenが取得可能_Dockが左側に存在_有効領域が返される( ) async {
4550 let nsScreenClient = testDependency ( of: NSScreenClient . self) {
4651 $0. mainScreen = { NSScreenMock ( x: 5 , y: 0 , width: 95 , height: 95 ) }
4752 }
@@ -53,73 +58,84 @@ final class ShiftServiceTests: XCTestCase {
5358 }
5459 let sut = ShiftService ( cgDirectDisplayClient, . testValue, nsAppClient, nsScreenClient, . testValue)
5560 let actual = await sut. getValidFrame ( )
56- XCTAssertEqual ( actual, CGRect ( x: 6 , y: 5 , width: 94 , height: 95 ) )
61+ #expect ( actual == CGRect ( x: 6 , y: 5 , width: 94 , height: 95 ) )
5762 }
5863
59- func test_makeNewFrame_幅が負_nilが返される( ) async {
64+ @Test
65+ func makeNewFrame_幅が負_nilが返される( ) async {
6066 let sut = ShiftService ( . testValue, . testValue, . testValue, . testValue, . testValue)
6167 let actual = await sut. makeNewFrame ( shiftType: . maximize, validFrame: CGRect ( x: 0 , y: 0 , width: - 1 , height: 0 ) )
62- XCTAssertNil ( actual)
68+ #expect ( actual == nil )
6369 }
6470
65- func test_makeNewFrame_高さが負_nilが返される( ) async {
71+ @Test
72+ func makeNewFrame_高さが負_nilが返される( ) async {
6673 let sut = ShiftService ( . testValue, . testValue, . testValue, . testValue, . testValue)
6774 let actual = await sut. makeNewFrame ( shiftType: . maximize, validFrame: CGRect ( x: 0 , y: 0 , width: 0 , height: - 1 ) )
68- XCTAssertNil ( actual)
75+ #expect ( actual == nil )
6976 }
7077
71- func test_makeNewFrame_上側1/2 _領域が返される( ) async {
78+ @Test
79+ func makeNewFrame_上側1/2 _領域が返される( ) async {
7280 let sut = ShiftService ( . testValue, . testValue, . testValue, . testValue, . testValue)
7381 let actual = await sut. makeNewFrame ( shiftType: . topHalf, validFrame: CGRect ( x: 0 , y: 0 , width: 100 , height: 100 ) )
74- XCTAssertEqual ( actual, CGRect ( x: 0 , y: 0 , width: 100 , height: 50 ) )
82+ #expect ( actual == CGRect ( x: 0 , y: 0 , width: 100 , height: 50 ) )
7583 }
7684
77- func test_makeNewFrame_下側1/2 _領域が返される( ) async {
85+ @Test
86+ func makeNewFrame_下側1/2 _領域が返される( ) async {
7887 let sut = ShiftService ( . testValue, . testValue, . testValue, . testValue, . testValue)
7988 let actual = await sut. makeNewFrame ( shiftType: . bottomHalf, validFrame: CGRect ( x: 0 , y: 0 , width: 100 , height: 100 ) )
80- XCTAssertEqual ( actual, CGRect ( x: 0 , y: 50 , width: 100 , height: 50 ) )
89+ #expect ( actual == CGRect ( x: 0 , y: 50 , width: 100 , height: 50 ) )
8190 }
8291
83- func test_makeNewFrame_左側1/2 _領域が返される( ) async {
92+ @Test
93+ func makeNewFrame_左側1/2 _領域が返される( ) async {
8494 let sut = ShiftService ( . testValue, . testValue, . testValue, . testValue, . testValue)
8595 let actual = await sut. makeNewFrame ( shiftType: . leftHalf, validFrame: CGRect ( x: 0 , y: 0 , width: 100 , height: 100 ) )
86- XCTAssertEqual ( actual, CGRect ( x: 0 , y: 0 , width: 50 , height: 100 ) )
96+ #expect ( actual == CGRect ( x: 0 , y: 0 , width: 50 , height: 100 ) )
8797 }
8898
89- func test_makeNewFrame_右側1/2 _領域が返される( ) async {
99+ @Test
100+ func makeNewFrame_右側1/2 _領域が返される( ) async {
90101 let sut = ShiftService ( . testValue, . testValue, . testValue, . testValue, . testValue)
91102 let actual = await sut. makeNewFrame ( shiftType: . rightHalf, validFrame: CGRect ( x: 0 , y: 0 , width: 100 , height: 100 ) )
92- XCTAssertEqual ( actual, CGRect ( x: 50 , y: 0 , width: 50 , height: 100 ) )
103+ #expect ( actual == CGRect ( x: 50 , y: 0 , width: 50 , height: 100 ) )
93104 }
94105
95- func test_makeNewFrame_左側1/3 _領域が返される( ) async {
106+ @Test
107+ func makeNewFrame_左側1/3 _領域が返される( ) async {
96108 let sut = ShiftService ( . testValue, . testValue, . testValue, . testValue, . testValue)
97109 let actual = await sut. makeNewFrame ( shiftType: . leftThird, validFrame: CGRect ( x: 0 , y: 0 , width: 100 , height: 100 ) )
98- XCTAssertEqual ( actual, CGRect ( x: 0 , y: 0 , width: 33 , height: 100 ) )
110+ #expect ( actual == CGRect ( x: 0 , y: 0 , width: 33 , height: 100 ) )
99111 }
100112
101- func test_makeNewFrame_左側2/3 _領域が返される( ) async {
113+ @Test
114+ func makeNewFrame_左側2/3 _領域が返される( ) async {
102115 let sut = ShiftService ( . testValue, . testValue, . testValue, . testValue, . testValue)
103116 let actual = await sut. makeNewFrame ( shiftType: . leftTwoThirds, validFrame: CGRect ( x: 0 , y: 0 , width: 100 , height: 100 ) )
104- XCTAssertEqual ( actual, CGRect ( x: 0 , y: 0 , width: 66 , height: 100 ) )
117+ #expect ( actual == CGRect ( x: 0 , y: 0 , width: 66 , height: 100 ) )
105118 }
106119
107- func test_makeNewFrame_中央1/3 _領域が返される( ) async {
120+ @Test
121+ func makeNewFrame_中央1/3 _領域が返される( ) async {
108122 let sut = ShiftService ( . testValue, . testValue, . testValue, . testValue, . testValue)
109123 let actual = await sut. makeNewFrame ( shiftType: . middleThird, validFrame: CGRect ( x: 0 , y: 0 , width: 100 , height: 100 ) )
110- XCTAssertEqual ( actual, CGRect ( x: 33 , y: 0 , width: 33 , height: 100 ) )
124+ #expect ( actual == CGRect ( x: 33 , y: 0 , width: 33 , height: 100 ) )
111125 }
112126
113- func test_makeNewFrame_右側2/3 _領域が返される( ) async {
127+ @Test
128+ func makeNewFrame_右側2/3 _領域が返される( ) async {
114129 let sut = ShiftService ( . testValue, . testValue, . testValue, . testValue, . testValue)
115130 let actual = await sut. makeNewFrame ( shiftType: . rightTwoThirds, validFrame: CGRect ( x: 0 , y: 0 , width: 100 , height: 100 ) )
116- XCTAssertEqual ( actual, CGRect ( x: 33 , y: 0 , width: 67 , height: 100 ) )
131+ #expect ( actual == CGRect ( x: 33 , y: 0 , width: 67 , height: 100 ) )
117132 }
118133
119- func test_makeNewFrame_右側1/3 _領域が返される( ) async {
134+ @Test
135+ func makeNewFrame_右側1/3 _領域が返される( ) async {
120136 let sut = ShiftService ( . testValue, . testValue, . testValue, . testValue, . testValue)
121137 let actual = await sut. makeNewFrame ( shiftType: . rightThird, validFrame: CGRect ( x: 0 , y: 0 , width: 100 , height: 100 ) )
122- XCTAssertEqual ( actual, CGRect ( x: 66 , y: 0 , width: 34 , height: 100 ) )
138+ #expect ( actual == CGRect ( x: 66 , y: 0 , width: 34 , height: 100 ) )
123139 }
124140}
125141
0 commit comments