예제 #1
0
        public async void Get_null_record()
        {
            var mock = new ServiceMockFacade <IReleaseRepository>();

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <string>())).Returns(Task.FromResult <Release>(null));
            var service = new ReleaseService(mock.LoggerMock.Object,
                                             mock.RepositoryMock.Object,
                                             mock.ModelValidatorMockFactory.ReleaseModelValidatorMock.Object,
                                             mock.BOLMapperMockFactory.BOLReleaseMapperMock,
                                             mock.DALMapperMockFactory.DALReleaseMapperMock);

            ApiReleaseResponseModel response = await service.Get(default(string));

            response.Should().BeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <string>()));
        }
예제 #2
0
        public async void ByVersionProjectId_Exists()
        {
            var mock   = new ServiceMockFacade <IReleaseRepository>();
            var record = new Release();

            mock.RepositoryMock.Setup(x => x.ByVersionProjectId(It.IsAny <string>(), It.IsAny <string>())).Returns(Task.FromResult(record));
            var service = new ReleaseService(mock.LoggerMock.Object,
                                             mock.RepositoryMock.Object,
                                             mock.ModelValidatorMockFactory.ReleaseModelValidatorMock.Object,
                                             mock.BOLMapperMockFactory.BOLReleaseMapperMock,
                                             mock.DALMapperMockFactory.DALReleaseMapperMock);

            ApiReleaseResponseModel response = await service.ByVersionProjectId(default(string), default(string));

            response.Should().NotBeNull();
            mock.RepositoryMock.Verify(x => x.ByVersionProjectId(It.IsAny <string>(), It.IsAny <string>()));
        }
예제 #3
0
        public async void TestGet()
        {
            ApiReleaseResponseModel response = await this.Client.ReleaseGetAsync("A");

            response.Should().NotBeNull();
        }