예제 #1
0
        public void NormalInsertArtist()
        {
            using (var scope = TestScope.Create())
            {
                var repository = scope.Resolve <Common.DomRepository>();
                var artist     = new TestComputedFromSelfExtension.Artist()
                {
                    Name         = "a1",
                    ToursRevenue = 10
                };

                repository.TestComputedFromSelfExtension.Artist.Insert(new[] { artist });
            }
        }
예제 #2
0
        public void RecomputeAfterInsert()
        {
            using (var scope = TestScope.Create())
            {
                var repository = scope.Resolve <Common.DomRepository>();
                var artist     = new TestComputedFromSelfExtension.Artist()
                {
                    Name         = "a2",
                    ToursRevenue = 1000
                };

                repository.TestComputedFromSelfExtension.Artist.Insert(new[] { artist });
                var computedArtist = repository.TestComputedFromSelfExtension.Artist
                                     .Query(item => item.ID == artist.ID)
                                     .SingleOrDefault();

                decimal expectedTotalRevenue = 1000;
                Assert.AreEqual(expectedTotalRevenue, computedArtist.TotalRevenue);
            }
        }