public void SomethingCreateInteractor_CreateSomething_PersistsSomethingWithName() { Mock <ISomethingFactory> mockSomethingFactory = new Mock <ISomethingFactory>(); mockSomethingFactory.Setup(x => x.Create(something.Name)).Returns(something); Mock <ISomethingPersistence> mockPersistence = new Mock <ISomethingPersistence>(); SomethingCreateInteractor somethingInteractor = new SomethingCreateInteractor(mockSomethingFactory.Object, mockPersistence.Object); somethingInteractor.CreateSomething(something.Name); mockPersistence.Verify(x => x.SaveSomething(something)); }
public async void SomethingCreateInteractor_CreateSomethingAsync_AsyncPersistsSomething() { Mock <ISomethingFactory> mockSomethingFactory = new Mock <ISomethingFactory>(); mockSomethingFactory.Setup(x => x.Create()).Returns(something); Mock <ISomethingPersistence> mockPersistence = new Mock <ISomethingPersistence>(); SomethingCreateInteractor somethingInteractor = new SomethingCreateInteractor(mockSomethingFactory.Object, mockPersistence.Object); await somethingInteractor.CreateSomethingAsync(); mockPersistence.Verify(x => x.SaveSomethingAsync(something)); }