public void AddItem()
        {
            // Arrange
            var sut = new RepositoryBaseHost(stubEntities, stubLogger);

            // Act
            sut.AddItem("Something");

            // Assert
            Assert.AreEqual(1, stubEntities.Count(), "Entities count incorrect");
        }
        public void AddThrowsRepositoryException()
        {
            // Arrange
            stubEntities.Add("Something");
            stubEntities.Add("Something");
            var sut = new RepositoryBaseHost(stubEntities, stubLogger);

            // Act
            sut.AddItem("Something");

            // Assert
            // Expected Exception Attribute
        }
        public void AddLogsErrorOnException()
        {
            // Arrange
            stubEntities.Add("Something");
            stubEntities.Add("Something");
            var sut = new RepositoryBaseHost(stubEntities, stubLogger);

            // Act
            try
            {
                sut.AddItem("Something");
            }
            catch { /* Expected */ }

            // Assert
            stubLogger.AssertWasCalled(l => l.Error("Doesn't matter - ignored", new Exception(), Category.Data), o => o.IgnoreArguments());
        }
        public void GetItem()
        {
            // Arrange
            var expected = "AValue";
            stubEntities.Add(expected);
            var sut = new RepositoryBaseHost(stubEntities, stubLogger);

            // Act
            string actual = sut.GetItem(expected);

            // Assert
            Assert.AreEqual(expected, actual);
        }
        public void GetItemThrowsRepositoryExceptionOnMultipleItems()
        {
            // Arrange
            var testVal = "AValue";
            stubEntities.Add(testVal);
            stubEntities.Add(testVal);
            var sut = new RepositoryBaseHost(stubEntities, stubLogger);

            // Act
            sut.GetItem(testVal);

            // Assert
            // Expected Exception Attribute
        }
        public void GetItemsThrowRespositoryException()
        {
            // Arrange
            var sut = new RepositoryBaseHost(stubEntities, stubLogger);

            // Act
            sut.GetItemsPredicate(null);

            // Assert
        }
        public void GetItemsLogsErrorOnException()
        {
            // Arrange
            var sut = new RepositoryBaseHost(stubEntities, stubLogger);

            // Act
            try
            {
                sut.GetItemsPredicate(null);
            }
            catch { /* Expected */ }

            // Assert
            stubLogger.AssertWasCalled(l => l.Error("", new Exception(), Category.Data), o => o.IgnoreArguments());
        }
        public void GetItemCollection()
        {
            // Arrange
            var expected = new string[] {"AValue", "AnotherValue"};
            stubEntities.Add(expected[0]);
            stubEntities.Add(expected[1]);
            var sut = new RepositoryBaseHost(stubEntities, stubLogger);

            // Act
            IEnumerable<string> actual = sut.GetItems("A");

            // Assert
            Assert.IsTrue(expected.SequenceEqual(actual));
        }