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

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

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

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

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

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

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