public void List_ReturnsWrappedContainers() { // Arrange var container1 = MockRepository.GenerateStub<IBlobContainer>(); var container2 = MockRepository.GenerateStub<IBlobContainer>(); var provider = MockRepository.GenerateStub<IBlobContainerManager>(); provider.Stub(x => x.List()).Return(new[] {container1, container2}); var testManager = new ContainerManager(provider); // Act var results = testManager.List(); // Assert Assert.That(results.Count(), Is.EqualTo(2)); Assert.That(results.Select(x => x.Provider), Has.Member(container1)); Assert.That(results.Select(x => x.Provider), Has.Member(container2)); }
public void List_CallsListMethodOnProvider() { // Arrange var provider = MockRepository.GenerateMock<IBlobContainerManager>(); provider.Expect(x => x.List()).Return(new List<IBlobContainer>()); var testManager = new ContainerManager(provider); // Act testManager.List(); // Arrange provider.AssertWasCalled(x => x.List()); }