示例#1
0
        public async Task Check_CreateRelationWorkingRight(int firstId, int secondId)
        {
            //Arrange
            var cls = new InMemoryAppDbContext();

            using (var context = cls.GetContextWithData())
            {
                IItemRelationRepository repo          = new ItemRelationRepository(context);
                ItemRelation            startRelation = new ItemRelation()
                {
                    FirstItemId = firstId, SecondItemId = secondId
                };

                await repo.CreateRecordAsync(startRelation);

                var actualRelation = context.ItemsRelations.Find(firstId, secondId);

                Assert.NotNull(actualRelation);
                Assert.Equal(startRelation, actualRelation);

                context.Database.EnsureDeleted();
            }
        }