Example #1
0
        public void Create()
        {
            var context = new Mock<IContextAware>();
            var collection = new TimingReportCollection();

            var report = new Mock<IProfilingTimeReport>();
            collection.Add(report.Object);

            var model = new ProfileModel(context.Object, collection);
            Assert.That(
                model.Results.Cast<IProfilingTimeReport>(),
                Is.EquivalentTo(collection));
        }
Example #2
0
        public void Create()
        {
            var context    = new Mock <IContextAware>();
            var collection = new TimingReportCollection();

            var report = new Mock <IProfilingTimeReport>();

            collection.Add(report.Object);

            var model = new ProfileModel(context.Object, collection);

            Assert.That(
                model.Results.Cast <IProfilingTimeReport>(),
                Is.EquivalentTo(collection));
        }
        public void Add()
        {
            var report = new Mock<IProfilingTimeReport>();

            var collection = new TimingReportCollection();
            collection.CollectionChanged +=
                (s, e) =>
                {
                    Assert.AreEqual(NotifyCollectionChangedAction.Add, e.Action);
                    Assert.AreEqual(1, e.NewItems.Count);
                    Assert.IsNull(e.OldItems);
                    Assert.AreSame(report.Object, e.NewItems[0]);
                };

            collection.Add(report.Object);
            Assert.That(
                collection,
                Is.EquivalentTo(
                    new List<IProfilingTimeReport>
                    {
                        report.Object,
                    }));
        }