public void SetUp() { var subject = new UserSessionService(null, null, null); var userToken = subject.NewUser(); _result = subject.GetBasketTotalForUser(userToken); }
public void SetUp() { _subject = new UserSessionService(null, null, null); _subject.NewUser(); _result = _subject.GetUserByUserToken("NOT_A_VALID_GUID"); }
public void SetUp() { _subject = new UserSessionService(null, null, null); _subject.NewUser(); _result = _subject.GetUserByUserToken(Guid.NewGuid().ToString()); }
public void SetUp() { var pizzaSizeRepository = new Mock <IPizzaSizeRepository>(); pizzaSizeRepository.Setup(x => x.GetByIds(It.IsAny <int>(), It.IsAny <int>())).Returns(() => new GetPizzaSizeResponse { PizzaSize = new PizzaSizeRecord { Price = 1500 } }); var toppingSizeRepository = new Mock <IToppingSizeRepository>(); toppingSizeRepository.Setup(x => x.GetByIds(It.IsAny <List <int> >(), It.IsAny <int>())) .Returns(() => new GetToppingSizeResponse()); var voucherService = new Mock <IVoucherService>(); var subject = new UserSessionService(pizzaSizeRepository.Object, toppingSizeRepository.Object, voucherService.Object); var userToken = subject.NewUser(); subject.AddItemToBasket(userToken, new BasketData { PizzaId = 1, SizeId = 1 }); _result = subject.GetBasketTotalForUser(userToken); }
public void SetUp() { var subject = new UserSessionService(null, null, null); var userToken = subject.NewUser(); _result = subject.GetUserByUserToken(userToken); }
public void SetUp() { _pizzaSizeRepository = new Mock <IPizzaSizeRepository>(); _pizzaSizeRepository.Setup(x => x.GetByIds(It.IsAny <int>(), It.IsAny <int>())).Returns(() => new GetPizzaSizeResponse { HasError = true, Error = new Error { UserMessage = "An error has occured" } }); _toppingSizeRepository = new Mock <IToppingSizeRepository>(); _voucherService = new Mock <IVoucherService>(); _subject = new UserSessionService(_pizzaSizeRepository.Object, _toppingSizeRepository.Object, _voucherService.Object); _result = _subject.NewUser(); var basketData = new BasketData { PizzaId = 1, SizeId = 2, ExtraToppingIds = new List <int> { 3, 4 } }; _subject.AddItemToBasket(_result, basketData); _basket = _subject.GetBasketForUser(_result); }
public void SetUp() { _subject = new UserSessionService(null, null, null); _userToken = _subject.NewUser(); _subject.LogIn(_userToken, 1); _subject.LogOut(Guid.NewGuid().ToString()); }
public void SetUp() { _subject = new UserSessionService(null, null, null); _userToken = _subject.NewUser(); _subject.LogIn(_userToken, 1); _subject.LogOut("NOT_A_VALID_GUID"); }
public void SetUp() { var subject = new UserSessionService(null, null, null); subject.NewUser(); _result = subject.IsLoggedIn(Guid.NewGuid().ToString()); }
public void SetUp() { var subject = new UserSessionService(null, null, null); subject.NewUser(); _result = subject.GetBasketTotalForUser(Guid.NewGuid().ToString()); }
public void SetUp() { var subject = new UserSessionService(null, null, null); var userToken = subject.NewUser(); subject.LogIn(userToken, 1); _result = subject.IsLoggedIn(userToken); }
public void SetUp() { var subject = new UserSessionService(null, null, null); var userToken = subject.NewUser(); subject.SetBasketForUser(userToken, new Data.Services.UserSession.Basket { Total = Money.From(5000) }); _result = subject.GetBasketForUser(userToken); }
public void SetUp() { var subject = new UserSessionService(null, null, null); var userToken = subject.NewUser(); subject.SetBasketForUser("SOME_INVALID_USER_TOKEN", new ShoppingCart.Services.UserSession.Basket { Total = Money.From(5000) }); _result = subject.GetBasketForUser(userToken); }
public void SetUp() { var subject = new UserSessionService(null, null, null); var userToken = subject.NewUser(); subject.SelectDeal("SOME_INVALID_USER_TOKEN", new VoucherDetailsModel { Voucher = new VoucherModel { Code = "SOME_VOUCHER_CODE" } }); _result = subject.GetVoucherForUser(userToken); }
public void SetUp() { _pizzaSizeRepository = new Mock <IPizzaSizeRepository>(); _pizzaSizeRepository.Setup(x => x.GetByIds(It.IsAny <int>(), It.IsAny <int>())).Returns(() => new GetPizzaSizeResponse { PizzaSize = new PizzaSizeRecord { Pizza = new PizzaRecord { Id = 1 }, Size = new SizeRecord { Id = 2 } } }); _toppingSizeRepository = new Mock <IToppingSizeRepository>(); _toppingSizeRepository.Setup(x => x.GetByIds(It.IsAny <List <int> >(), It.IsAny <int>())).Returns(() => new GetToppingSizeResponse { ToppingSize = new List <ToppingSizeRecord> { new ToppingSizeRecord { Topping = new ToppingRecord { Id = 3 }, Size = new SizeRecord { Id = 2 } } } }); _voucherService = new Mock <IVoucherService>(); var subject = new UserSessionService(_pizzaSizeRepository.Object, _toppingSizeRepository.Object, _voucherService.Object); var userToken = subject.NewUser(); subject.AddItemToBasket(userToken, new BasketData { PizzaId = 1, SizeId = 2, ExtraToppingIds = new List <int> { 3 } }); subject.ClearBasketForUser(Guid.NewGuid().ToString()); _result = subject.GetBasketForUser(userToken); }
public void SetUp() { _pizzaSizeRepository = new Mock <IPizzaSizeRepository>(); _toppingSizeRepository = new Mock <IToppingSizeRepository>(); _voucherService = new Mock <IVoucherService>(); _subject = new UserSessionService(_pizzaSizeRepository.Object, _toppingSizeRepository.Object, _voucherService.Object); _subject.NewUser(); var basketData = new BasketData { PizzaId = 1, SizeId = 2, ExtraToppingIds = new List <int> { 3, 4 } }; _subject.AddItemToBasket("NOT A VALID GUID", basketData); _basket = _subject.GetBasketForUser("NOT A VALID GUID"); }
public void SetUp() { _pizzaSizeRepository = new Mock <IPizzaSizeRepository>(); _pizzaSizeRepository.Setup(x => x.GetByIds(It.IsAny <int>(), It.IsAny <int>())).Returns(() => new GetPizzaSizeResponse { PizzaSize = new PizzaSizeRecord { Pizza = new PizzaRecord { Id = 1, Name = "Original" }, Size = new SizeRecord { Id = 2, Name = "Medium" }, Price = 1200 } }); _toppingSizeRepository = new Mock <IToppingSizeRepository>(); _toppingSizeRepository.Setup(x => x.GetByIds(It.IsAny <List <int> >(), It.IsAny <int>())).Returns(() => new GetToppingSizeResponse { ToppingSize = new List <ToppingSizeRecord> { new ToppingSizeRecord { Topping = new ToppingRecord { Id = 3, Name = "Cheese" }, Size = new SizeRecord { Id = 2, Name = "Medium" }, Price = 100 }, new ToppingSizeRecord { Topping = new ToppingRecord { Id = 4, Name = "Tomato Sauce" }, Size = new SizeRecord { Id = 2, Name = "Medium" }, Price = 100 } } }); _voucherService = new Mock <IVoucherService>(); _subject = new UserSessionService(_pizzaSizeRepository.Object, _toppingSizeRepository.Object, _voucherService.Object); _result = _subject.NewUser(); var basketData = new BasketData { PizzaId = 1, SizeId = 2, ExtraToppingIds = new List <int> { 3, 4 } }; _subject.AddItemToBasket(_result, basketData); _basket = _subject.GetBasketForUser(_result); }
public void SetUp() { _subject = new UserSessionService(null, null, null); _result = _subject.NewUser(); }