public void Test_IfRepoDoesNotContainConfig_ThenCantHandle() { var configRepositoryMock = new Mock <INooliteSwitchInfoRepository>(MockBehavior.Strict); configRepositoryMock .Setup(repository => repository.ContainsConfig(It.IsAny <SwitchId>())) .Returns(Task.FromResult(false)); var controller = new NooliteSwitchController(configRepositoryMock.Object, Mock.Of <IPC11XXAdapter>()); Assert.False(controller.CanHandleSwitch(SwitchId.NewId())); configRepositoryMock.Verify(repo => repo.ContainsConfig(It.IsAny <SwitchId>()), Times.Once); }
public void Test_IfRepoContainsConfig_ThenCanHandle() { var configRepositoryMock = new Mock <INooliteSwitchInfoRepository>(MockBehavior.Strict); var switchId = SwitchId.NewId(); configRepositoryMock .Setup(repository => repository.ContainsConfig(switchId)) .Returns(Task.FromResult(true)); var controller = new NooliteSwitchController(configRepositoryMock.Object, Mock.Of <IPC11XXAdapter>()); Assert.True(controller.CanHandleSwitch(switchId)); configRepositoryMock.Verify(repo => repo.ContainsConfig(switchId), Times.Once); }