public void LayoutToAndFromBsonShouldSucceed()
        {
            // Arrange
            var layoutId    = Guid.NewGuid();
            var layoutClass = new LayoutClass()
            {
                Id = layoutId
            };


            // Act
            var bson       = layoutClass.ToBson();
            var rehydrated = BsonSerializer.Deserialize <LayoutClass>(bson);

            // Assert
            rehydrated.Should().NotBeNull();
            rehydrated.Id.Should().Be(layoutId);
        }
Beispiel #2
0
        public void OnChangedPasses()
        {
            var target = new LayoutClass();

            Assert.IsFalse(target.DoChanged);

            var callCounter = 0;

            (ILayout self, bool doChanged)recievedValue = default;
            target.OnChanged.Add((_self, _do) => {
                callCounter++;
                recievedValue = (_self, _do);
            });

            target.SetDoChanged(true);

            Assert.AreEqual(1, callCounter);
            Assert.AreSame(target, recievedValue.self);
            Assert.IsTrue(recievedValue.doChanged);
        }
Beispiel #3
0
        public void OnChangedOperationPriorityPasses()
        {
            var layout = new LayoutClass();

            int callCounter = 0;

            (ILayout self, int prevPriority)recievedValues = default;
            layout.OnChangedOperationPriority.Add((_self, _prev) => {
                callCounter++;
                recievedValues.self         = _self;
                recievedValues.prevPriority = _prev;
            });

            var prevPriority = layout.OperationPriority;

            layout.OperationPriority = layout.OperationPriority + 1;

            Assert.AreEqual(1, callCounter);
            Assert.AreSame(layout, recievedValues.self);
            Assert.AreEqual(prevPriority, recievedValues.prevPriority);
        }
        public void TeamClassToAndFromBsonShouldSucceed()
        {
            // Arrange
            var teamId          = TeamId.New;
            var teamName        = new Name("Name");
            var teamImage       = "Image.png";
            var teamDescription = (Description)"Team Description";
            var layoutId        = Guid.NewGuid();
            var layout          = new LayoutClass()
            {
                Id = layoutId
            };
            var filterContent = "filterContent";
            var team          = new TeamClass()

            {
                Id            = teamId.GetGuid(),
                Name          = teamName,
                Description   = teamDescription,
                Image         = teamImage,
                Layout        = layout,
                FilterContent = filterContent
            };

            // Act
            var bson       = team.ToBson();
            var rehydrated = BsonSerializer.Deserialize <TeamClass>(bson);

            // Assert
            rehydrated.Should().NotBeNull();
            rehydrated.Name.Should().Be(teamName);
            rehydrated.Image.Should().Be(teamImage);
            rehydrated.Description.Should().Be(teamDescription);
            rehydrated.Layout.Id.Should().Be(layoutId);
            rehydrated.FilterContent.Should().Be(filterContent);
        }
Beispiel #5
0
        public void CallOnChangedTargetPasses()
        {
            var target = new LayoutClass();
            var obj    = new LayoutTargetObject();

            {
                target.Target = obj; // <- test point
                Assert.AreEqual(1, target.CallCounterOnChangedTarget);
                Assert.AreSame(obj, target.CurrentOnChangedTarget);
                Assert.AreSame(null, target.PrevOnChangedTarget);
            }

            {
                target.CallCounterOnChangedTarget = 0;
                target.CurrentOnChangedTarget     = null;
                target.PrevOnChangedTarget        = null;

                target.Target = null; // <- test point

                Assert.AreEqual(1, target.CallCounterOnChangedTarget);
                Assert.AreSame(null, target.CurrentOnChangedTarget);
                Assert.AreSame(obj, target.PrevOnChangedTarget);
            }
        }
 public static extern void CheckLayoutClass(LayoutClass c);