Пример #1
0
        public void GetByUniqueKey_ShouldReturnNull_WhenWrongSubnodeIdOrCode()
        {
            // Arrange
            var context = GetContext(TestData.marks);
            var repo    = new SqlMarkRepo(context);

            var subnodeId = TestData.marks[0].Subnode.Id;
            var code      = TestData.marks[0].Code;

            // Act
            var mark1 = repo.GetByUniqueKey(999, code);
            var mark2 = repo.GetByUniqueKey(subnodeId, "NotFound");

            // Assert
            Assert.Null(mark1);
            Assert.Null(mark2);

            context.Database.EnsureDeleted();
            context.Dispose();
        }
Пример #2
0
        public void GetByUniqueKey_ShouldReturnMark()
        {
            // Arrange
            var context = GetContext(TestData.marks);
            var repo    = new SqlMarkRepo(context);

            var id        = 1;
            var subnodeId = TestData.marks[0].Subnode.Id;
            var code      = TestData.marks[0].Code;

            // Act
            var mark = repo.GetByUniqueKey(subnodeId, code);

            // Assert
            Assert.Equal(id, mark.Id);

            context.Database.EnsureDeleted();
            context.Dispose();
        }