public void ReturnsPropertyValue() { var value = Container.GetProperty("Name"); Assert.Equal("Value", value); ContainerPropertiesService.Received(1).GetProperty(Container, "Name"); }
public void ThrowsInvalidOperationWhenIOExceptionThrownAndDestroyed() { Container.Destroy(); ContainerPropertiesService.GetProperties(Container).Returns(x => { throw new IOException(); }); Assert.Throws <InvalidOperationException>(() => Container.GetProperties()); }
public void WhenPropertyDoesNotExist_ReturnsNull() { ContainerPropertiesService.GetProperty(Container, "Unknown").Returns((string)null); var value = Container.GetProperty("Unknown"); Assert.Null(value); ContainerPropertiesService.Received(1).GetProperty(Container, "Unknown"); }
public void ReturnsProperties() { Properties["Name"] = "Value"; var properties = Container.GetProperties(); Assert.Collection(properties, x => { Assert.Equal("Name", x.Key); Assert.Equal("Value", x.Value); } ); ContainerPropertiesService.Received(1).GetProperties(Container); }
public void SetsProperties() { var spec = new ContainerSpec { Handle = "handle", Properties = new Dictionary <string, string> { { "name1", "value1" }, { "name2", "value2" }, }, }; var container = Service.CreateContainer(spec); ContainerPropertiesService.Received(1).SetProperties(container, spec.Properties); }
public void ReturnsProperties() { var properties = new Dictionary <string, string>() { { "name1", "value1" }, { "name2", "value2" }, }; ContainerPropertiesService.GetProperties(Container).Returns(properties); var info = Container.GetInfo(); Assert.Equal( new HashSet <string>(properties.Keys), new HashSet <string>(info.Properties.Keys) ); }
public void SetsProperty() { Container.SetProperty("Name", "Value"); ContainerPropertiesService.Received(1).SetProperty(Container, "Name", "Value"); }
public void RemovesProperty() { Container.RemoveProperty("Name"); ContainerPropertiesService.Received(1).RemoveProperty(Container, "Name"); }
public void PassesThroughExceptionIfNotDestroyed() { ContainerPropertiesService.GetProperties(Container).Returns(x => { throw new IOException(); }); Assert.Throws <IOException>(() => Container.GetProperties()); }
public GetProperties() { Properties = new Dictionary <string, string>(); ContainerPropertiesService.GetProperties(Container).Returns(Properties); }
public GetProperty() { ContainerPropertiesService.GetProperty(Container, "Name").Returns("Value"); }