Exemplo n.º 1
0
        public void BenchmarkWithNoCacheImmutable()
        {
            var immutable = new StructImmutable(Guid.NewGuid(), "name", DateTime.Now);

            foreach (var _ in Enumerable.Range(0, Settings.IterationCount))
            {
                immutable.WithNoCache(x => x.Name, "new name");
            }
        }
Exemplo n.º 2
0
        public void WhenImmutableWithNoCacheShouldCreateACopyWithANewValue()
        {
            var immutable = new StructImmutable(Guid.NewGuid(), "name", DateTime.Now);

            var result = immutable.WithNoCache(x => x.Name, "new name");

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