예제 #1
0
        public void CreateEntityWithValidInput()
        {
            // ARRANGE
            DTOModelA modelA = new DTOModelA
            {
                Id      = 0,
                Name    = "Pippo",
                Surname = "Poppi"
            };

            DTOModelA result = new DTOModelA();

            IEntityA mockEntityA = Substitute.For <EntityAMock>();

            IRepositoryA mockRepositoryA = Substitute.For <RepositoryAMock>();

            mockRepositoryA.CreateEntity(mockEntityA);

            IDataStore    mockDataStore    = Substitute.For <DataStoreMock>();
            IDataSupplier mockDataSupplier = Substitute.For <DataSupplierMock>();
            ICoreStore    mockCoreStore    = Substitute.For <CoreStoreMock>();

            // ACT
            ICoreSupplier testCoreSupplier = CoreSupplier.Instance(mockCoreStore);

            testCoreSupplier.GetFeatureA.CreatePost(modelA);
            result = testCoreSupplier.GetFeatureA.DetailsGet(modelA);

            // ASSERT
            Assert.IsInstanceOf <DTOModelA>(result);
            Assert.AreEqual(modelA.Id, result.Id);
        }
예제 #2
0
        public static IRepositoryA Instance(string connectionString, IProjectDbContext projectDbContext)
        {
            if (RepositoryAInstance == null)
            {
                RepositoryAInstance = new RepositoryA(connectionString, projectDbContext);
            }

            return(RepositoryAInstance);
        }
예제 #3
0
        public static IRepositoryA Instance(string connectionString)
        {
            if (RepositoryAInstance == null)
            {
                RepositoryAInstance = new RepositoryA(connectionString);
            }

            return(RepositoryAInstance);
        }
예제 #4
0
        public static IRepositoryA Instance(IProjectDbContext projectDbContext)
        {
            if (RepositoryAInstance == null)
            {
                RepositoryAInstance = new RepositoryA(projectDbContext);
            }

            return(RepositoryAInstance);
        }
예제 #5
0
        public static IRepositoryA Instance()
        {
            if (RepositoryAInstance == null)
            {
                RepositoryAInstance = new RepositoryA();
            }

            return(RepositoryAInstance);
        }
예제 #6
0
        public static IDataStore Instance(IRepositoryA repositoryA, IRepositoryB repositoryB)
        {
            if (DataStoreInstance == null)
            {
                DataStoreInstance = new DataStore(repositoryA, repositoryB);
            }

            return(DataStoreInstance);
        }
예제 #7
0
        public AppServiceTest(IRepositoryA repoA, IRepositoryB repoB)
        {
            if (repoA == null)
            {
                throw new ArgumentNullException("repoA");
            }

            if (repoB == null)
            {
                throw new ArgumentNullException("repoA");
            }

            _repoA = repoA;
            _repoB = repoB;
        }
 public Processor(IRepositoryA repositoryA)
 {
     _repositoryA = repositoryA;
 }
 // Pass Mock Repositories in unit tests -> PS: You can't have 2 constructors if you're using dependency injection.
 public Service(RepositoryA a, RepositoryB b)
 {
     _a = a;
     _b = b;
 }
예제 #10
0
 protected DataStore(IRepositoryA repositoryA, IRepositoryB repositoryB)
 {
     DataRepositoryA = repositoryA;
     DataRepositoryB = repositoryB;
 }
예제 #11
0
 protected DataStore(IRepositoryA repositoryA)
 {
     DataRepositoryA = repositoryA;
 }