Ejemplo n.º 1
0
        public void TestDispersing()
        {
            var stowage = new Stowage();

            stowage.StowingMode();

            stowage.Stow <object>(LocalMessage("1"));
            stowage.Stow <object>(LocalMessage("2"));
            stowage.Stow <object>(LocalMessage("3"));

            Assert.True(stowage.HasMessages);

            stowage.DispersingMode();

            Assert.Equal("1", stowage.SwapWith <object>(LocalMessage("4")).Representation);
            Assert.Equal("2", stowage.SwapWith <object>(LocalMessage("5")).Representation);
            Assert.Equal("3", stowage.SwapWith <object>(LocalMessage("6")).Representation);

            Assert.True(stowage.HasMessages);
            Assert.True(stowage.IsDispersing);
            Assert.NotNull(stowage.Head);
            Assert.True(stowage.IsDispersing);
            Assert.NotNull(stowage.Head);
            Assert.True(stowage.IsDispersing);
            Assert.NotNull(stowage.Head);
            Assert.True(stowage.IsDispersing);
            Assert.Null(stowage.Head);
            Assert.False(stowage.IsDispersing);
        }
Ejemplo n.º 2
0
        public void TestHead()
        {
            var stowage = new Stowage();

            stowage.StowingMode();

            stowage.Stow <object>(LocalMessage());
            stowage.Stow <object>(LocalMessage());
            stowage.Stow <object>(LocalMessage());

            Assert.NotNull(stowage.Head);
            Assert.NotNull(stowage.Head);
            Assert.NotNull(stowage.Head);
            Assert.Null(stowage.Head);
        }
Ejemplo n.º 3
0
        public void TestReset()
        {
            var stowage = new Stowage();

            stowage.StowingMode();

            Assert.True(stowage.IsStowing);
            Assert.False(stowage.IsDispersing);

            stowage.Stow <object>(LocalMessage());
            stowage.Stow <object>(LocalMessage());
            stowage.Stow <object>(LocalMessage());

            Assert.True(stowage.HasMessages);

            stowage.Reset();

            Assert.False(stowage.HasMessages);
            Assert.False(stowage.IsStowing);
            Assert.False(stowage.IsDispersing);
        }
Ejemplo n.º 4
0
        public void TestStowHasMessages()
        {
            IMessage _;

            var stowage = new Stowage();

            stowage.StowingMode();

            stowage.Stow <object>(LocalMessage());
            Assert.True(stowage.HasMessages);

            _ = stowage.Head;
            Assert.False(stowage.HasMessages);

            stowage.Stow <object>(LocalMessage());
            stowage.Stow <object>(LocalMessage());
            Assert.True(stowage.HasMessages);

            _ = stowage.Head;
            Assert.True(stowage.HasMessages);

            _ = stowage.Head;
            Assert.False(stowage.HasMessages);
        }