Ejemplo n.º 1
0
        public void Combine_SecondInfoIsEmpty_ReturnsFirstInfo()
        {
            //Arrange
            var firstInfo = new RelatedEntityInfo("a.c.b", "aId..bId");
            var secondInfo = new RelatedEntityInfo();

            //Act
            var result = RelatedEntityInfo.Combine(firstInfo, secondInfo);

            //Assert
            Assert.AreEqual(firstInfo, result);
        }
Ejemplo n.º 2
0
        public void Equals_Equals_ReturnsTrue()
        {
            //Arrange
            var info1 = new RelatedEntityInfo("a.x.b", "aId..bId");
            var info2 = new RelatedEntityInfo("a.x.b", "aId..bId");

            //Act
            var equal = info1.Equals(info2);

            //Assert
            Assert.IsTrue(equal);
        }
Ejemplo n.º 3
0
        public void Combine_GoodValues_ReturnsCombinedInfo()
        {
            //Arrange
            var firstInfo = new RelatedEntityInfo("a.c.b", "aId..bId");
            var secondInfo = new RelatedEntityInfo("b.c", "bId.");

            //Act
            var result = RelatedEntityInfo.Combine(firstInfo, secondInfo);

            //Assert
            Assert.AreEqual(new RelatedEntityInfo("a.c.b.b.c", "aId..bId.bId."), result);
        }
Ejemplo n.º 4
0
        public void WithoutLast_WhenNotEmpty_ReturnsWithoutLast()
        {
            //Arrange
            var info = new RelatedEntityInfo("a.bbb.cc", "aId..ccId");

            //Act
            var result = info.WithoutLast();

            //Assert
            Assert.AreEqual(new RelatedEntityInfo("a.bbb", "aId."), result);
        }
Ejemplo n.º 5
0
        public void RelatedEntityInfo_InitializesEmptyInstance()
        {
            //Arrange
            //Act
            var info = new RelatedEntityInfo();

            //Assert
            Assert.IsTrue(info.IsEmpty());
        }
Ejemplo n.º 6
0
        public void WithoutLast_WhenEmpty_ReturnsEmpty()
        {
            //Arrange
            var info = new RelatedEntityInfo();

            //Act
            var result = info.WithoutFirst();

            //Assert
            Assert.AreEqual(new RelatedEntityInfo(), result);
        }
Ejemplo n.º 7
0
        public void Last_WhenNotEmpty_ReturnsLast()
        {
            //Arrange
            var info1 = new RelatedEntityInfo("a.bbb.cc", "aId..ccId");
            var info2 = new RelatedEntityInfo("a.bbb.cc", "aId..");

            //Act
            var result1 = info1.Last();
            var result2 = info2.Last();

            //Assert
            Assert.AreEqual(new RelatedEntityInfo("cc", "ccId"), result1);
            Assert.AreEqual(new RelatedEntityInfo("cc", string.Empty), result2);
        }
Ejemplo n.º 8
0
        public void IsEmpty_IsEmpty_ReturnsTrue()
        {
            //Arrange
            //Act
            var info = new RelatedEntityInfo(string.Empty, string.Empty);

            //Assert
            Assert.IsTrue(info.IsEmpty());
        }
Ejemplo n.º 9
0
        public void Includes_WhenNotIncludes_ReturnsFalse()
        {
            //Arrange
            var info = new RelatedEntityInfo("a.c.b", "aId..bId");
            var other = new RelatedEntityInfo("a.x", ".xId");

            //Act
            var result = info.Includes(other);

            //Assert
            Assert.IsFalse(result);
        }
Ejemplo n.º 10
0
        public void Includes_OtherIsNull_ThrowsArgumentNullException()
        {
            //Arrange
            var info = new RelatedEntityInfo("a.c.b", "aId..bId");

            //Act
            //Assert
            var result = info.Includes(null);
        }
Ejemplo n.º 11
0
        public void First_WhenNotEmpty_ReturnsFirst()
        {
            //Arrange
            var info = new RelatedEntityInfo("a.x", ".xId");

            //Act
            var result = info.First();

            //Assert
            Assert.AreEqual(new RelatedEntityInfo("a", string.Empty), result);
        }