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 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 GetItemLogsErrorOnException() { // Arrange var testVal = "AValue"; stubEntities.Add(testVal); stubEntities.Add(testVal); var sut = new RepositoryBaseHost(stubEntities, stubLogger); // Act try { sut.GetItem(testVal); } catch { /* Expected */ } // Assert stubLogger.AssertWasCalled(l => l.Error("Doesn't matter - ignored", new Exception(), Category.Data), o => o.IgnoreArguments()); }