public void Setup() { _transactionScope = new TransactionScope(); _domicile = BuildMeA.Domicile("code", "description"); _manCo1 = BuildMeA.ManCo("description1", "code1").WithDomicile(_domicile); _docType = BuildMeA.DocType("code", "description"); _subDocType1 = BuildMeA.SubDocType("code 1", "description 1").WithDocType(_docType); _document1 = BuildMeA.Document("id").WithDocType(_docType).WithSubDocType(_subDocType1).WithManCo(_manCo1); _document2 = BuildMeA.Document("id2").WithDocType(_docType).WithSubDocType(_subDocType1).WithManCo(_manCo1); _document3 = BuildMeA.Document("id3").WithDocType(_docType).WithSubDocType(_subDocType1).WithManCo(_manCo1); _cartItem1 = BuildMeA.CartItem("Key1") .WithDocument(_document1); _cartItem2 = BuildMeA.CartItem("Key1") .WithDocument(_document2); _cartItem3 = BuildMeA.CartItem("Key2") .WithDocument(_document3); _cartItem4 = BuildMeA.CartItem("Key1") .WithDocument(_document3); _cartItem5 = BuildMeA.CartItem("Key1") .WithDocument(_document3); _cartItemRepository = new CartItemRepository(ConfigurationManager.ConnectionStrings["Unity"].ConnectionString); _cartItemRepository.Create(_cartItem1); _cartItemRepository.Create(_cartItem2); _cartItemRepository.Create(_cartItem3); }
public void GivenACartItem_WhenITryToSaveToTheDatabase_ItIsSavedToTheDatabase() { int initialCount = _cartItemRepository.Entities.Count(); _cartItemRepository.Create(_cartItem1); _cartItemRepository.Entities.Count().Should().Be(initialCount + 1); }