Exemplo n.º 1
0
        public void BenchmarkWithNoCacheMutable()
        {
            var mutable = new Mutable {
                Id = Guid.NewGuid(), Name = "name", Date = DateTime.Now
            };

            foreach (var _ in Enumerable.Range(0, Settings.IterationCount))
            {
                mutable.With(x => x.Name, "new name");
            }
        }
Exemplo n.º 2
0
        public void WhenMutableWithShouldCreateACopyWithANewValue()
        {
            var mutable = new Mutable {
                Id = Guid.NewGuid(), Name = "name", Date = DateTime.Now
            };

            var result = mutable.With(x => x.Name, "new name");

            result.ShouldNotBe(mutable);
            result.Id.ShouldBe(mutable.Id);
            result.Date.ShouldBe(mutable.Date);
            result.Name.ShouldBe("new name");
        }