public void SystemChargeShouldNotAcceptNegativeValues() { var loggerMock = new Mock <ILogger>(); //var system = new SubscriptonSystem(new TestLogger()); var system = new SubscriptonSystem(loggerMock.Object); system.Charge(-500); }
public void UsersShouldBeCharged() { var loggerMock = new Mock <ILogger>(); //var system = new SubscriptonSystem(new TestLogger()); var system = new SubscriptonSystem(loggerMock.Object); var user1 = new User(); var user2 = new User(); system.Users.Add(user1); system.Users.Add(user2); system.Charge(500); Assert.AreEqual(500, user1.Balance); Assert.AreEqual(500, user2.Balance); }
public void SystemChargeShoudLog() { var loggerMock = new Mock <ILogger>(); bool isLogged = false; loggerMock.Setup(x => x.Log(It.IsAny <string>())).Callback(() => { isLogged = true; }); //var logger = new TestLogger(); var logger = loggerMock.Object; //logger.Logged = false; //var system = new SubscriptonSystem(logger); var system = new SubscriptonSystem(loggerMock.Object); system.Charge(100); //Assert.IsTrue(logger.Logged); Assert.IsTrue(isLogged); }