Skip to content

Commit

Permalink
코드 재정렬
Browse files Browse the repository at this point in the history
  • Loading branch information
jojoldu committed Dec 3, 2024
1 parent 05b8897 commit 4efc070
Showing 1 changed file with 31 additions and 35 deletions.
66 changes: 31 additions & 35 deletions posts/구름_COMMIT_발표/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,41 @@


```java
public class LogAnalyzerTests
{
public void Analyze_TooShortFileName_CallsWebService()
{
ManualMockService mockService = new ManualMockService ();
LogAnalyzer log = new LogAnalyzer(mockService);
string tooShortFileName="abc.ext";
log.Analyze(tooShortFileName);
Assert.AreEqual("Filename too short:abc.ext",
mockService.LastError);
}
}
public class ManualMockService:IWebService
{
public string LastError;

public void LogError(string message)
{
LastError = message;
}
}
public class LogAnalyzerTests {
public void Analyze_TooShortFileName_CallsWebService() {
ManualMockService mockService = new ManualMockService();
LogAnalyzer log = new LogAnalyzer(mockService);
string tooShortFileName = "abc.ext";

log.Analyze(tooShortFileName);

Assert.AreEqual("Filename too short:abc.ext", mockService.LastError);
}
}

public class ManualMockService : IWebService {
public string LastError;

public void LogError(string message) {
LastError = message;
}
}
```

```java
public void Analyze_TooShortFileName_ErrorLoggedToService()
{
MockRepository mocks = new MockRepository();
IWebService simulatedService =
MockRespository.DynamicMock<IWebService>();

using(mocks.Record())
{
simulatedService.LogError("bad string");
}
public void Analyze_TooShortFileName_ErrorLoggedToService() {
MockRepository mocks = new MockRepository();
IWebService simulatedService = MockRepository.DynamicMock<IWebService>();

using (mocks.Record()) {
simulatedService.LogError("bad string");
}

LogAnalyzer log = new LogAnalyzer(simulatedService);
string tooShortFileName = "abc.ext";

LogAnalyzer log = new LogAnalyzer(simulatedService);
string tooShortFileName="abc.ext";
log.Analyze(tooShortFileName);
log.Analyze(tooShortFileName);

mocks.VerifyAll();
mocks.VerifyAll();
}
```

0 comments on commit 4efc070

Please sign in to comment.