コード例 #1
0
        public void Create_WithInvalidName_ThrowsInvalidNameException()
        {
            // Arrange
              var manager = new RackspaceContainerManager(MockRepository.GenerateStub<IConnection>());

              // Act & Assert
              Assert.Throws<InvalidNameException>(() => manager.Create(null));
        }
コード例 #2
0
        public void Create_ExistingContainer_ReturnsContainer(string name)
        {
            // Arrange
              var container = MockRepository.GenerateStub<IContainer>();
              container.Stub(x => x.Name).Return(name);
              var account = MockRepository.GenerateStub<IAccount>();
              account.Stub(x => x.ContainerExists(name)).Return(true);
              account.Stub(x => x.GetContainer(name)).Return(container);

              var manager = new RackspaceContainerManager { Account = account };

              // Act
              var result = manager.Create(name);

              // Assert
              Assert.That(result.Name, Is.EqualTo(name));
        }