Ejemplo n.º 1
0
        public void ActivateTimeLogCreatesNewTimeLogIfItsNotInFileSystem()
        {
            var fileManager = NewMock <ITimeLogsFileManager>();

            Expect.Once.On(fileManager).Method("GetTimeLog").Will(Return.Value(null));
            Stub.On(fileManager).Method("SaveTimeLog").Will(Return.Value(true));
            var timeLogsManager = new TimeLogsManager(fileManager);

            var timeLog = timeLogsManager.ActivateTimeLog(DateTime.Now);

            Assert.IsNotNull(timeLog);
        }
Ejemplo n.º 2
0
        public void ActivateTimeLogCallsSave()
        {
            ITimeLogsFileManager fileManager = NewMock <ITimeLogsFileManager>();

            Stub.On(fileManager).Method("GetTimeLog").Will(Return.Value(NewMock <ITimeLog>()));
            var timeLogsManager = new TimeLogsManager(fileManager);

            Expect.Once.On(fileManager).Method("SaveTimeLog").Will(Return.Value(true));

            timeLogsManager.ActiveTimeLog = NewMock <ITimeLog>();
            timeLogsManager.ActivateTimeLog(DateTime.Now);

            VerifyAllExpectationsHaveBeenMet();
        }