public ChangeEmitResult(ChangeReport report, IChangeTransferCondition selectCondition, IChangeTransfer transfer, string transfed)
 {
     Report          = report;
     SelectCondition = selectCondition;
     Transfer        = transfer;
     Transfed        = transfed;
 }
        public void EmitWithTransfer_MustReturnResult()
        {
            var reports = new ChangeReport[]
            {
                new ChangeReport(null, null, new IConfigurationChangeInfo[]
                {
                    new ConfigurationChangeInfo()
                })
            };
            var condition = new IChangeTransferCondition[]
            {
                new NullTransfer()
            };
            var saver = new ChangeSaver(reports, condition);
            var map   = saver.Emit();

            Assert.AreEqual(1, map.Count);
            Assert.IsTrue(map.ContainsKey(reports[0]));
            var res = map[reports[0]];

            Assert.AreEqual(map.Keys.First(), res.Report);
            Assert.AreEqual(condition[0], res.Transfer);
            Assert.AreEqual(condition[0], res.SelectCondition);
            Assert.AreEqual(string.Empty, res.Transfed);
        }
        public void EmitWithNoting_MutReturnEmptyDic()
        {
            var reports   = new ChangeReport[0];
            var condition = new IChangeTransferCondition[0];
            var saver     = new ChangeSaver(reports, condition);
            var map       = saver.Emit();

            Assert.AreEqual(0, map.Count);
        }
        public void PropertyValueMustEqualInput()
        {
            var reports   = new ChangeReport[0];
            var condition = new IChangeTransferCondition[0];
            var saver     = new ChangeSaver(reports, condition);

            Assert.AreEqual(reports, saver.Reports);
            Assert.AreEqual(condition, saver.Transfers);

            saver = new ChangeSaver(reports, (IEnumerable <IChangeTransferCondition>)condition);
            Assert.AreEqual(reports, saver.Reports);
            Assert.AreEqual(condition, saver.Transfers);
        }
示例#5
0
        public void CallEmitAndSave_MustReturnReport()
        {
            var reports = new ChangeReport[]
            {
                new ChangeReport(null, null, new IConfigurationChangeInfo[]
                {
                    new ConfigurationChangeInfo()
                })
            };
            var saver = new IChangeTransferCondition[]
            {
                new NullTransfer()
            };
            var rep = new ChangeSaver(reports, saver);
            var res = ChangeSaverExtensions.EmitAndSave(rep);

            Assert.IsNotNull(res);
        }
示例#6
0
        public void Init_PropertyValueMustGiven(bool includeAction)
        {
            var             val        = new object();
            var             ts         = TimeSpan.FromDays(1);
            var             conditions = new IChangeTransferCondition[0];
            Action <Action> action     = x => x();
            BindSettings    setting    = null;

            if (includeAction)
            {
                setting = new BindSettings(val, ts, conditions, action);
            }
            else
            {
                setting = new BindSettings(val, ts, conditions);
            }
            Assert.AreEqual(val, setting.Value);
            Assert.AreEqual(ts, setting.DelayTime);
            Assert.AreEqual(conditions, setting.Conditions);
            if (includeAction)
            {
                Assert.AreEqual(action, setting.Updater);
            }
        }