public void SetUpSettings()
        {
            _uploadSettings = new UploadSettings();
            _uploadSettings.Initialize();

            _mockSettingsStore = new Mock <ISettingsStore>();
            _mockSettingsStore.Setup(store => store.GetSettings <UploadSettings>()).Returns(_uploadSettings);
            _mockSettingsStore.Setup(store => store.SetSettings(It.IsAny <UploadSettings>()))
            .Callback <UploadSettings>(settings => _updatedUploadSettings = settings);
        }
        public void ShouldInitializeWithCurrentDate()
        {
            var uut = new UploadSettings();

            uut.Initialize();
            var now = DateTimeOffset.Now;

            Assert.IsTrue(uut.IsInitialized());
            Assert.IsTrue(GetDiffInMs(uut.LastNotificationDate, now) < 50);
            Assert.IsTrue(GetDiffInMs(uut.LastUploadDate, now) < 50);
        }
示例#3
0
        public void ShouldInitializeWithCurrentDate()
        {
            var uut = new UploadSettings();

            uut.Initialize();
            var dateTime = DateTime.Now;

            Assert.IsTrue(uut.IsInitialized());
            var comparer = new SimilarDateTimeComparer(50);

            Assert.IsTrue(comparer.Equal(dateTime, uut.LastNotificationDate));
            Assert.IsTrue(comparer.Equal(dateTime, uut.LastUploadDate));
        }