Example #1
0
            public void ReturnsPropertyValue()
            {
                var value = Container.GetProperty("Name");

                Assert.Equal("Value", value);
                ContainerPropertiesService.Received(1).GetProperty(Container, "Name");
            }
Example #2
0
            public void ThrowsInvalidOperationWhenIOExceptionThrownAndDestroyed()
            {
                Container.Destroy();
                ContainerPropertiesService.GetProperties(Container).Returns(x => { throw new IOException(); });

                Assert.Throws <InvalidOperationException>(() => Container.GetProperties());
            }
Example #3
0
            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");
            }
Example #4
0
            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);
            }
Example #6
0
            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)
                    );
            }
Example #7
0
            public void SetsProperty()
            {
                Container.SetProperty("Name", "Value");

                ContainerPropertiesService.Received(1).SetProperty(Container, "Name", "Value");
            }
Example #8
0
            public void RemovesProperty()
            {
                Container.RemoveProperty("Name");

                ContainerPropertiesService.Received(1).RemoveProperty(Container, "Name");
            }
Example #9
0
            public void PassesThroughExceptionIfNotDestroyed()
            {
                ContainerPropertiesService.GetProperties(Container).Returns(x => { throw new IOException(); });

                Assert.Throws <IOException>(() => Container.GetProperties());
            }
Example #10
0
            public GetProperties()
            {
                Properties = new Dictionary <string, string>();

                ContainerPropertiesService.GetProperties(Container).Returns(Properties);
            }
Example #11
0
 public GetProperty()
 {
     ContainerPropertiesService.GetProperty(Container, "Name").Returns("Value");
 }