Exemplo n.º 1
0
        public void AddPartToShelfShouldAddPart()
        {
            Part receivedPart = null;
            var  expected     = new Part();
            var  store        = new Store();
            var  shelf        = new Shelf();

            store.Shelves.Add(shelf);
            _storageSystem.Stores.Add(store);
            var addPartEvent = _eventAggregator.GetEvent <PubSubEvent <AddPartEvent> >();

            addPartEvent.Subscribe(e => receivedPart = e.Part);

            _storageSystem.AddPartToShelf(store.Shelves.First(), expected);

            Task.Delay(25).Wait();
            shelf.Parts.Count.Should().Be(1);
            shelf.Parts.First().Should().Be(expected);
            receivedPart.Should().Be(expected);
        }