public async Task ShouldCheckInPersons() { var addressRepository = Substitute.For <IRepository <Address, Guid> >(); var addressDataProvider = Substitute.For <IAddressDataProvider>(); var addressFactory = new AddressFactory(); var addressEntity = addressFactory.Create(new AddressFactoryInput() { City = "test", Street = "test", HomeNumber = "test", StreetNumber = "test", Id = Guid.NewGuid() }); addressRepository.Get(addressEntity.Id).Returns(addressEntity); AddressController addressController = new AddressController(addressRepository, addressDataProvider, addressFactory, Substitute.For <IMeterReadDataProvider>()); await addressController.CheckInPerson(new CheckIn() { AddressId = addressEntity.Id, Persons = 5 }); await addressRepository.Received(1).Get(addressEntity.Id); Assert.Equal(5, addressEntity.CheckedInPersons); }