Exemplo n.º 1
0
        public TestDto Update(TestDto test)
        {
            var updatedTest = _testRepository.Update(new Test
            {
                Id = test.Id,
                Name = test.Name,
                Date = test.Date,
                MaximumScore = test.MaximumScore,
                Weight = test.Weight
            });

            if (updatedTest == null)
            {
                return null;
            }

            return new TestDto
            {
                Id = updatedTest.Id,
                Name = updatedTest.Name,
                Date = updatedTest.Date,
                MaximumScore = updatedTest.MaximumScore,
                Weight = updatedTest.Weight
            };
        }
Exemplo n.º 2
0
        public TestDto Create(TestDto test)
        {
            var createdClassGroup = _testRepository.Create(new Test
            {
                Id = test.Id,
                Name = test.Name,
                Date = test.Date,
                MaximumScore = test.MaximumScore,
                Weight = test.Weight
            });

            if (createdClassGroup == null)
            {
                return null;
            }

            return new TestDto
            {
                Id = createdClassGroup.Id,
                Name = createdClassGroup.Name,
                Date = createdClassGroup.Date,
                MaximumScore = createdClassGroup.MaximumScore,
                Weight = createdClassGroup.Weight
            };
        }
Exemplo n.º 3
0
        public void CanCreate()
        {
            var testToCreateDto = new TestDto { Name = "Bakken" };
            var createdTest = new Business.Entity.Test { Id = 1, Name = testToCreateDto.Name };

            _testRepository.Create(Arg.Any<Business.Entity.Test>()).Returns(createdTest);

            var createdTestDto = _testFacade.Create(testToCreateDto);

            _testRepository.Received().Create(Arg.Any<Business.Entity.Test>());
            Assert.NotNull(createdTestDto);
            Assert.Equal(createdTest.Id, createdTestDto.Id);
        }
Exemplo n.º 4
0
        public void CanUpdate()
        {
            var updatedTest = new Business.Entity.Test { Id = 1, Name = "Bakken" };
            var testToUpdateDto = new TestDto { Id = updatedTest.Id, Name = updatedTest.Name };

            _testRepository.Update(Arg.Any<Business.Entity.Test>()).Returns(updatedTest);

            var updatedTestDto = _testFacade.Update(testToUpdateDto);

            _testRepository.Received().Update(Arg.Any<Business.Entity.Test>());
            Assert.NotNull(updatedTestDto);
            Assert.Equal(updatedTestDto.Id, updatedTestDto.Id);
            Assert.Equal(updatedTestDto.Name, updatedTestDto.Name);
        }
Exemplo n.º 5
0
        public void CanGet()
        {
            _server.Run((baseUri, server) =>
            {
                server.RegisterInstance(_testFacade);

                var test = new TestDto { Id = 1, Name = "Snijden" };

                _testFacade.Get(test.Id).ReturnsForAnyArgs(test);

                var foundTest = DomainAgent.CreateTestRestClient(baseUri).Get(test.Id);

                _testFacade.Received().Get(test.Id);
                Assert.NotNull(foundTest);
                Assert.Equal(test.Id, foundTest.Id);
            });
        }
Exemplo n.º 6
0
        public void CanCreate()
        {
            _server.Run((baseUri, server) =>
            {
                server.RegisterInstance(_testFacade);

                var testToCreateDto = new TestDto { Name = "Bakken" };
                var createdTestDto = new TestDto { Id = 1, Name = testToCreateDto.Name };

                _testFacade.Create(Arg.Any<TestDto>()).ReturnsForAnyArgs(createdTestDto);

                var test = DomainAgent.CreateTestRestClient(baseUri).Create(testToCreateDto);

                _testFacade.Received().Create(Arg.Any<TestDto>());
                Assert.NotNull(test);
                Assert.True(test.Id > 0);
                Assert.Equal(testToCreateDto.Name, test.Name);
            });
        }
Exemplo n.º 7
0
 public TestDto Update(TestDto test)
 {
     return _testFacade.Update(test);
 }
Exemplo n.º 8
0
 public TestDto Create(TestDto test)
 {
     return _testFacade.Create(test);
 }
Exemplo n.º 9
0
 public TestDto Update(TestDto test)
 {
     return Put<TestDto, TestDto>("api/test", test);
 }
Exemplo n.º 10
0
 public TestDto Create(TestDto test)
 {
     return Post<TestDto, TestDto>("api/test", test);
 }
Exemplo n.º 11
0
 public TestDto Update(TestDto test)
 {
     return _testClient.Update(test);
 }
Exemplo n.º 12
0
 public TestDto Create(TestDto test)
 {
     return _testClient.Create(test);
 }