Created
August 31, 2021 06:15
-
-
Save percybolmer/5e1b1056b8acb9bb325e5e7fe51b7e50 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Test_MongoTavern(t *testing.T) { | |
// Create OrderService | |
products := init_products(t) | |
os, err := order.NewOrderService( | |
order.WithMongoCustomerRepository("mongodb://localhost:27017"), | |
order.WithMemoryProductRepository(products), | |
) | |
if err != nil { | |
t.Error(err) | |
} | |
tavern, err := NewTavern(WithOrderService(os)) | |
if err != nil { | |
t.Error(err) | |
} | |
uid, err := os.AddCustomer("Percy") | |
if err != nil { | |
t.Error(err) | |
} | |
order := []uuid.UUID{ | |
products[0].GetID(), | |
} | |
// Execute Order | |
err = tavern.Order(uid, order) | |
if err != nil { | |
t.Error(err) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment