private static StoreInfo CreateUpdatedResponse(StoreInfo original)
        {
            var updatedResponse = StoreInfoFactory.Create(original.StoreNumber);

            updatedResponse.Address1 = Guid.NewGuid().ToString();
            updatedResponse.Address2 = Guid.NewGuid().ToString();
            return(updatedResponse);
        }
        public void CannotUpdateANonExistingStore()
        {
            CreatePersistenceInitializer().Initialize();

            _dataService.CreateNew(new []
            {
                StoreInfoFactory.Create("11111-3"),
                StoreInfoFactory.Create("22222-3"),
                StoreInfoFactory.Create("33333-3")
            });

            var response = StoreInfoFactory.Create("55555-3");

            ((Action)(() =>
            {
                _dataService.Update(new [] { response });
            })).Should().Throw <InvalidOperationException>();

            ((Action)(() =>
            {
                _dataService.Update(new [] { response, StoreInfoFactory.Create("22222-3") });
            })).Should().Throw <InvalidOperationException>();
        }
        public void CannotInsertTheSameItemTwice()
        {
            CreatePersistenceInitializer().Initialize();

            var response1 = StoreInfoFactory.Create("11111-3");
            var response2 = StoreInfoFactory.Create("11111-3");

            _dataService.CreateNew(new [] { response1 });

            ((Action)(() =>
            {
                _dataService.CreateNew(new [] { response1 });
            })).Should().Throw <DbUpdateException>();

            ((Action)(() =>
            {
                _dataService.CreateNew(new [] { response2 });
            })).Should().Throw <DbUpdateException>();

            ((Action)(() =>
            {
                _dataService.CreateNew(new [] { response1, response2 });
            })).Should().Throw <InvalidOperationException>();
        }