public async void GetProducerId_Test() { int sampleProducerId = 2; var producerAccess = new Mock <IProducerAccess>(); producerAccess .Setup(x => x.GetProducerId(It.IsAny <string>())) .ReturnsAsync(sampleProducerId); DeviceModel deviceModel = new DeviceModel(producerAccess.Object) { ProducerName = "someProducer" }; // Act var producerId = await deviceModel.GetProducerId(deviceModel.ProducerName); // Act Assert.Equal(sampleProducerId, producerId); Assert.True(producerId.GetType() == typeof(int)); }