This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package interfaceadapter | |
type WebPresenter struct { | |
mExternalDevice ExternalDevice | |
} | |
func NewWebPresenter(aExternalDevice ExternalDevice) *WebPresenter { | |
return &WebPresenter{ | |
mExternalDevice:aExternalDevice, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package externalinterface | |
import ( | |
"log" | |
"sync" | |
"text/template" | |
"path/filepath" | |
"net/http" | |
"../interfaceadapter" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package usecase | |
import "strconv" | |
type Withdrawal struct{ | |
mOutputBoundary OutputBoundary | |
mDataAccessor DataAccessor | |
} | |
func CreateWithdrawal(aOutputBoundary OutputBoundary, | |
aDataAccessor DataAccessor) *Withdrawal{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func TestWithdrawal_minusValue(t *testing.T){ | |
// 準備 | |
outputBoundary := createDummyOutputBoundary() | |
dataAccessor := createDummyDataAccessor(200) | |
dummyInput := make(map[string]string) | |
dummyInput["amount_of_money"] = "-100" | |
// 実行 | |
testee := CreateWithdrawal(outputBoundary, dataAccessor) | |
testee.Input(dummyInput) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package usecase | |
import "strconv" | |
type Withdrawal struct{ | |
mOutputBoundary OutputBoundary | |
mDataAccessor DataAccessor | |
} | |
func CreateWithdrawal(aOutputBoundary OutputBoundary, | |
aDataAccessor DataAccessor) *Withdrawal{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package usecase | |
import ( | |
"testing" | |
"../testutil" | |
) | |
// 正常系のテスト | |
func TestWithdrawal(t *testing.T){ | |
// 準備 | |
outputBoundary := createDummyOutputBoundary() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package usecase | |
import "../entity" | |
type dummyDataAccessor struct { | |
mBalanceValue int | |
} | |
func createDummyDataAccessor(aBalanceValue int) *dummyDataAccessor{ | |
return &dummyDataAccessor{ | |
mBalanceValue: aBalanceValue, |