public void SenderConditionAlways_Condition() { // Setup var senderFactoryMock = new Mock<ISenderFactory>(); var senderConditionAlways = new SenderConditionAlways<DateTime>(senderFactoryMock.Object); senderFactoryMock.SetupGet(m => m.Available).Returns(true); // Run & Assert Assert.IsTrue(senderConditionAlways.TestCondition()); Assert.IsTrue(senderConditionAlways.TestCondition(DateTime.Now)); senderFactoryMock.SetupGet(m => m.Available).Returns(false); Assert.IsFalse(senderConditionAlways.TestCondition()); Assert.IsFalse(senderConditionAlways.TestCondition(DateTime.Now)); }
public void SenderConditionAlways_Construction() { // Setup var senderFactoryMock = new Mock<ISenderFactory>(); var senderConditionAlways = new SenderConditionAlways<DateTime>(senderFactoryMock.Object); senderFactoryMock.Setup(m => m.Sender()).Returns(new MockSender()); // Run & Assert AssertException.Throws<ArgumentNullException>(() => new SenderConditionAlways<DateTime>(null)); Assert.IsNotNull(senderConditionAlways.Sender()); senderFactoryMock.SetupGet(m => m.Available).Returns(true); Assert.IsTrue(senderConditionAlways.Available); senderFactoryMock.SetupGet(m => m.Available).Returns(false); Assert.IsFalse(senderConditionAlways.Available); }