예제 #1
0
        public void Sharding_Always_ShouldSaveAllData()
        {
            using (SimpleStorageTestHelpers.StartService(port1))
                using (SimpleStorageTestHelpers.StartService(port2))
                    using (SimpleStorageTestHelpers.StartService(port3))
                    {
                        var items = new List <KeyValuePair <string, Value> >();
                        for (var i = 0; i < 100; i++)
                        {
                            var id    = Guid.NewGuid().ToString();
                            var value = new Value {
                                Content = "content"
                            };
                            items.Add(new KeyValuePair <string, Value>(id, value));
                            simpleStorageClient.Put(id, value);
                        }

                        foreach (var item in items)
                        {
                            var actual = simpleStorageClient.Get(item.Key);
                            Assert.That(actual.Content, Is.EqualTo(item.Value.Content));
                            Assert.That(actual.IsDeleted, Is.EqualTo(item.Value.IsDeleted));
                            Assert.That(actual.Revision, Is.EqualTo(item.Value.Revision));
                        }
                    }
        }
예제 #2
0
        public void Sharding_AllShards_ShouldContainSomeData()
        {
            using (SimpleStorageTestHelpers.StartService(port1))
                using (SimpleStorageTestHelpers.StartService(port2))
                    using (SimpleStorageTestHelpers.StartService(port3))
                    {
                        for (var i = 0; i < 100; i++)
                        {
                            simpleStorageClient.Put(Guid.NewGuid().ToString(), new Value {
                                Content = "content"
                            });
                        }

                        Assert.That(GetAll(endpoint1).ToArray(), Has.Length.GreaterThan(0));
                        Assert.That(GetAll(endpoint2).ToArray(), Has.Length.GreaterThan(0));
                        Assert.That(GetAll(endpoint3).ToArray(), Has.Length.GreaterThan(0));
                    }
        }