Beispiel #1
0
        public void Setup()
        {
            var context = MoqDbContext.GetMockedContext();
            var repo    = new GenericRepository <ApplicationDbContext, FileBlob>(context.Object);
            var repoUrl = new GenericRepository <ApplicationDbContext, Url> (context.Object);
            var mapper  = new Mapper(new MapperConfiguration(cfg =>
            {
                cfg.AddProfile(new ServerMapperProfile());
            }));


            this.dataSerivce = new BaseDataService <FileBlob, FileBlob, FileBlob, FileBlob, ApplicationDbContext>(repo, mapper, context.Object);

            this.dataSerivceUrl = new BaseDataService <Url, Url, Url, Url, ApplicationDbContext>(repoUrl, mapper, context.Object);
        }
Beispiel #2
0
        public void MockPropRecursive()
        {
            //Moq
            MoqDbContext.Setup(x => x.DbSet.Name).Returns("Name");

            //NSubstitute
            NsubDbContext.DbSet.Name.Returns("Name");

            //FakeItEasy
            A.CallTo(() => FieDbContext.DbSet.Name).Returns("Name");

            #region Assertion

            MoqDbContext.Object.DbSet.Name.Should().BeEquivalentTo("Name");

            NsubDbContext.DbSet.Name.Should().BeEquivalentTo("Name");

            FieDbContext.DbSet.Name.Should().BeEquivalentTo("Name");

            #endregion
        }
Beispiel #3
0
        public void MockConcreteProp()
        {
            //Moq
            MoqDbContext.Setup(x => x.DbSet).Returns(new DbSet("Name"));

            //NSubstitute
            NsubDbContext.DbSet.Returns(new DbSet("Name"));

            //FakeItEasy
            A.CallTo(() => FieDbContext.DbSet).Returns(new DbSet("Name"));

            #region Assertion

            MoqDbContext.Object.DbSet.Should().BeEquivalentTo(new DbSet("Name"));

            NsubDbContext.DbSet.Should().BeEquivalentTo(new DbSet("Name"));

            FieDbContext.DbSet.Should().BeEquivalentTo(new DbSet("Name"));

            #endregion
        }
Beispiel #4
0
        public void Setup()
        {
            var context = MoqDbContext.GetMockedContext();

            this.repo = new GenericRepository <ApplicationDbContext, FileBlob>(context.Object);
        }