コード例 #1
0
        public void Test_DeleteFigurById()
        {
            IFigurRepository figurRepository = new FigurRepository();

            const int figurId = 1;

            Assert.IsTrue(figurRepository.HasId(figurId));

            figurRepository.DeleteById(figurId);

            Assert.IsFalse(figurRepository.HasId(figurId));

            FigurDto figur = new FigurDto(figurId, "Plastik", "Alles was plaste ist",(decimal) 1.00,1);

            figurRepository.Add(figur);

            Assert.IsTrue(figurRepository.HasId(figurId));
            Assert.AreEqual(figurId, figur.FigurId);
            Assert.AreEqual("Plastik", figur.FigurName);
            Assert.AreEqual("Alles was plaste ist", figur.Description);
        }
コード例 #2
0
        public void Test_AddFigur()
        {
            IFigurRepository figurRepository = new FigurRepository();

            FigurDto figurDto = new FigurDto(1,string.Empty,string.Empty,(decimal) 0.00,1);

            figurRepository.Add(figurDto);

            const int figurId = 4;

            FigurDto newFigurDto = figurRepository.GetById(figurId);

            Assert.IsNotNull(newFigurDto);
            Assert.AreEqual(4, newFigurDto.FigurId);
            Assert.AreEqual("Name", newFigurDto.FigurName);
            Assert.AreEqual("Test", newFigurDto.Description);

            figurRepository.DeleteById(figurId);

            Assert.IsTrue(figurRepository.HasId(figurId));
        }