public void ThrowArgumentNullException_WhenrocessingOrderFactoryParameterIsNull() { // Arrange Mock <ICoffeeStore> storeMock = new Mock <ICoffeeStore>(); Mock <IMenuProvider> menuProviderMock = new Mock <IMenuProvider>(); IProcessingOrderFactory orderFactoryMock = null; // Act && Assert Assert.That(() => new StoreController(storeMock.Object, menuProviderMock.Object, orderFactoryMock), Throws.TypeOf <ArgumentNullException>()); }
public StoreController( ICoffeeStore store, IMenuProvider menuProvider, IProcessingOrderFactory orderFactory) { if (store == null) { throw new ArgumentNullException(); } if (menuProvider == null) { throw new ArgumentNullException(); } if (orderFactory == null) { throw new ArgumentNullException(); } this.store = store; this.orderFactory = orderFactory; this.menuProvider = menuProvider; }