public MembershipOrder CreateMembershipOrder() { var membershipOrder = new MembershipOrder(); membershipOrder.DateCreated = DateTime.Now; return membershipOrder; }
public MembershipOrder CreateMembershipOrder() { var membershipOrder = new MembershipOrder(); membershipOrder.DateCreated = DateTime.Now; return(membershipOrder); }
public void SaveIndexModelShouldSaveNewOrder() { var indexModel = new IndexModel(); var membershipOrder = new MembershipOrder(); _mockIndexModelMapper.Setup( mapper => mapper.GetMembershipOrderForIndexModel( indexModel, _mockOrderRepository.Object)) .Returns(membershipOrder); _indexModelRepository.SaveIndexModel( indexModel); _mockOrderRepository.Verify( repos => repos.SaveMembershipOrder( membershipOrder)); }
public int SaveMembershipOrder(MembershipOrder membershipOrder) { dynamic queryValue; RunDatabaseOperation( database => { queryValue = database.QuerySingle(InsertOrderQuery, membershipOrder.FirstName, membershipOrder.LastName, membershipOrder.EmailAddress, membershipOrder.DateOfBirth, membershipOrder.CreditCardNumber, membershipOrder.CreditCardType.Code, membershipOrder.MembershipOffer.Id, membershipOrder.DateCreated); membershipOrder.OrderId = Convert.ToInt32(queryValue.Id); }); return membershipOrder.OrderId; }
public void SaveMembershipOrderShouldPersistAnOrderAndReturnTheId() { var membershipOffer = new MembershipOffer(); membershipOffer.Id = 1; var membershipOrder = new MembershipOrder(); membershipOrder.FirstName = "firstname"; membershipOrder.LastName = "lastname"; membershipOrder.EmailAddress = "*****@*****.**"; membershipOrder.DateOfBirth = new DateTime(1980, 1, 1); membershipOrder.CreditCardNumber = "4444444444444"; membershipOrder.CreditCardType = CreditCardType.Visa; membershipOrder.MembershipOffer = membershipOffer; membershipOrder.DateCreated = new DateTime(2000, 1, 1); var newOrderId = _orderRepository.SaveMembershipOrder(membershipOrder); Assert.That(newOrderId, Is.Not.EqualTo(0)); Assert.That(newOrderId, Is.EqualTo(membershipOrder.OrderId)); var database = Database.Open("IntegrationTests.Properties.Settings.TDDWithMVCConnectionString"); var insertedOrder = database.QuerySingle("SELECT * FROM MembershipOrder WHERE Id = @0", newOrderId); Assert.AreEqual(insertedOrder.FirstName, "firstname"); Assert.AreEqual(insertedOrder.LastName, "lastname"); Assert.AreEqual(insertedOrder.EmailAddress, "*****@*****.**"); Assert.AreEqual(insertedOrder.DateOfBirth, new DateTime(1980, 1, 1)); Assert.AreEqual(insertedOrder.CreditCardNumber, "4444444444444"); Assert.AreEqual(insertedOrder.CreditCardTypeCode, CreditCardType.Visa.Code); Assert.AreEqual(insertedOrder.MembershipOfferId, membershipOffer.Id); Assert.AreEqual(insertedOrder.DateCreated, new DateTime(2000, 1, 1)); }
public int SaveMembershipOrder( MembershipOrder membershipOrder) { SaveMembershipOrderWasCalled = true; SaveMembershipOrderArgumentMembershipOrder = membershipOrder; return 10; }