public void EntityType_ShouldReflectRepositoryEntityType()
        {
            // Arrange.
            var dataStore = SimulatedBarDataStore.NewDefaultInstance();

            using (var target = new SimulatedBarRepository(dataStore))
            {
                // Assert.
                target.EntityType.Should().Be(typeof(SimulatedBarEntity));
            }
        }
        public void Any_ShouldProduceDesiredResults_ForPositiveMatch()
        {
            // Arrange.
            var dataStore = SimulatedBarDataStore.NewDefaultInstance();

            using (var target = new SimulatedBarRepository(dataStore))
            {
                // Assert.
                target.Any().Should().BeTrue();
            }
        }
        public void Count_ShouldProduceDesiredResults()
        {
            // Arrange.
            var dataStore = SimulatedBarDataStore.NewDefaultInstance();

            using (var target = new SimulatedBarRepository(dataStore))
            {
                // Assert.
                target.Count().Should().Be(dataStore.Count);
            }
        }
        public void ContainsWhere_ShouldReturnFalse_ForNegativeMatch()
        {
            // Arrange.
            var dataStore  = SimulatedBarDataStore.NewDefaultInstance();
            var identifier = Guid.NewGuid();

            using (var target = new SimulatedBarRepository(dataStore))
            {
                // Assert.
                target.ContainsWhere(targetEntity => targetEntity.Identifier == identifier).Should().BeFalse();
            }
        }
        public void Contains_ShouldReturnFalse_ForNegativeMatch()
        {
            // Arrange.
            var dataStore  = SimulatedBarDataStore.NewDefaultInstance();
            var identifier = Guid.NewGuid();
            var entity     = new SimulatedBarEntity(identifier, identifier.GetHashCode());

            using (var target = new SimulatedBarRepository(dataStore))
            {
                // Assert.
                target.Contains(entity).Should().BeFalse();
            }
        }
        public void AddRange_ShouldProduceDesiredResults()
        {
            // Arrange.
            var dataStore   = SimulatedBarDataStore.NewDefaultInstance();
            var identifiers = new Guid[] { Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid() };
            var entities    = identifiers.Select(identifier => new SimulatedBarEntity(identifier, identifier.GetHashCode()));

            using (var target = new SimulatedBarRepository(dataStore))
            {
                // Act.
                target.AddRange(entities);
            }

            // Assert.
            dataStore.Should().ContainKeys(identifiers);
        }
        public void CountWhere_ShouldProduceDesiredResults()
        {
            // Arrange.
            var dataStore  = SimulatedBarDataStore.NewDefaultInstance();
            var identifier = Guid.NewGuid();
            var entity     = new SimulatedBarEntity(identifier, identifier.GetHashCode());

            using (var target = new SimulatedBarRepository(dataStore))
            {
                // Arrange.
                target.Add(entity);

                // Assert.
                target.CountWhere(targetEntity => targetEntity.Identifier == identifier).Should().Be(1);
            }
        }
        public void Add_ShouldProduceDesiredResults()
        {
            // Arrange.
            var dataStore  = SimulatedBarDataStore.NewDefaultInstance();
            var identifier = Guid.NewGuid();
            var entity     = new SimulatedBarEntity(identifier, identifier.GetHashCode());

            using (var target = new SimulatedBarRepository(dataStore))
            {
                // Act.
                target.Add(entity);
            }

            // Assert.
            dataStore.Should().ContainKey(identifier);
        }
        public void ContainsWhere_ShouldReturnTrue_ForPositiveMatch()
        {
            // Arrange.
            var dataStore  = SimulatedBarDataStore.NewDefaultInstance();
            var identifier = Guid.NewGuid();
            var entity     = new SimulatedBarEntity(identifier, identifier.GetHashCode());

            using (var target = new SimulatedBarRepository(dataStore))
            {
                // Arrange.
                target.Add(entity);

                // Assert.
                target.ContainsWhere(targetEntity => targetEntity.Identifier == identifier).Should().BeTrue();
            }
        }
        public void All_ShouldReturnAllEntities()
        {
            // Arrange.
            var dataStore = SimulatedBarDataStore.NewDefaultInstance();

            using (var target = new SimulatedBarRepository(dataStore))
            {
                // Act.
                var result = target.All();

                // Assert.
                result.Should().NotBeNullOrEmpty();

                foreach (var entity in result)
                {
                    // Assert.
                    dataStore.GetEntityByIdentifier(entity.Identifier).Value.Should().Be(entity.Value);
                }
            }
        }