public void Setup() { _mockSessionFactory = new Mock<IMySessionFactory>(); _mockSettingsFactory = new Mock<ISettingsFactory>(); _session = new Mock<ISession>(); _transaction = new Mock<ITransaction>(); _repository = new InventoryItemRepository(); _inventoryItem = new InventoryItem(); Bootstrapper.BootstrapStructureMap(); ObjectFactory.Inject(typeof(IMySessionFactory), _mockSessionFactory.Object); ObjectFactory.Inject(typeof(ISettingsFactory), _mockSettingsFactory.Object); _mockSessionFactory.Setup(x => x.OpenSession()).Returns(_session.Object); _session.Setup(x => x.BeginTransaction()).Returns(_transaction.Object); }
public void Setup() { //_athleteDto = new AthleteDto() { Nickname = "sheredia", FirstName = "Sarah", LastName = "Heredia", Gender = 'F', TrainerSizeW = 9, SpikeSizeW = 9.5, Notes = "Some notes on Sarah", Status = "Current" }; _modelDto = new Model() { ModelNumber = "1234", ModelName = "Model name", Type = "Runner", Color = "White", Price = 105.00, IsDiscontinued = false }; _inventoryItemDto = new InventoryItem() { Model = _modelDto, SizeM = 9, SizeW = 11, Width = 'N', RequestName = "request1", Status = Constants.Inventory.REQUESTED, StatusLastChanged = DateTime.Now }; _inventoryItemRepository = ObjectFactory.GetInstance<InventoryItemRepository>(); //_athleteDto.Inventory.Add(_inventoryItemDto); Bootstrapper.BootstrapStructureMap(); ObjectFactory.GetInstance<IMySessionFactory>().ExportSchema(); //CoreAthleteService.SaveAthlete(_athleteDto); _inventoryItemDto.SerialNumber = _inventoryItemRepository.Save(_inventoryItemDto); }