示例#1
0
        public void GetMemberByID_MemberExists()
        {
            Guid   ID             = Guid.NewGuid();
            Member expectedMember = new Member
            {
                IDMember    = ID,
                Description = "description1",
                Name        = "name1",
                Position    = "phd1",
                Resume      = string.Empty,
                Title       = "title1"
            };
            Member member2 = new Member
            {
                IDMember    = Guid.NewGuid(),
                Description = "description2",
                Name        = "name2",
                Position    = "phd2",
                Resume      = string.Empty,
                Title       = "title2"
            };

            dbContext.Members.InsertOnSubmit(expectedMember);
            dbContext.Members.InsertOnSubmit(member2);
            dbContext.SubmitChanges();

            MemberModel result = memberRepository.GetMemberByID(ID);

            Assert.IsNotNull(result);
            Assert.AreEqual(ID, result.IDMember);
            AssertUtility.AssertAreEqual(expectedMember, result);
        }
        public void GetAllMembers_TwoRecordsExists()
        {
            //Arrange
            Player player1 = new Player
            {
                IDPlayer  = Guid.NewGuid(),
                Name      = "name",
                Surname   = "name1",
                Position  = "phd1",
                Team      = "M",
                Value_EUR = 1234567,
                IdTeam    = Guid.NewGuid()
            };

            Player player2 = new Player
            {
                IDPlayer  = Guid.NewGuid(),
                Name      = "namesaS",
                Surname   = "surname1",
                Position  = "FDSD",
                Team      = "qwwe",
                Value_EUR = 876543,
                IdTeam    = Guid.NewGuid()
            };

            List <PlayerModel> result = playerRepository.GetAllPlayers();

            //Assert
            Assert.AreEqual(2, result.Count);
            AssertUtility.AssertAreEqual(player1, result[0]);
            AssertUtility.AssertAreEqual(player2, result[1]);
        }
示例#3
0
        public void GetAllMembers_TwoRecordsExists()
        {
            Member member1 = new Member
            {
                IDMember    = Guid.NewGuid(),
                Description = "description1",
                Name        = "name1",
                Position    = "phd1",
                Resume      = string.Empty,
                Title       = "title1"
            };

            Member member2 = new Member
            {
                IDMember    = Guid.NewGuid(),
                Description = "description2",
                Name        = " name2",
                Position    = "phd2",
                Resume      = string.Empty,
                Title       = "title2"
            };

            dbContext.Members.InsertOnSubmit(member1);
            dbContext.Members.InsertOnSubmit(member2);
            dbContext.SubmitChanges();

            List <MemberModel> result = memberRepository.GetAllMembers();

            Assert.AreEqual(2, result.Count);

            AssertUtility.AssertAreEqual(member1, result[0]);
            AssertUtility.AssertAreEqual(member2, result[1]);
        }
        public void GetPacientByID_PacientExists()
        {
            Guid   ID             = Guid.NewGuid();
            Player expectedMember = new Player
            {
                IDPlayer  = ID,
                Name      = "namesdddaS",
                Surname   = "surnamedddddddd1",
                Position  = "FDSDddd",
                Team      = "qwwedddd",
                Value_EUR = 876543,
                IdTeam    = Guid.NewGuid()
            };

            Player player2 = new Player
            {
                IDPlayer  = Guid.NewGuid(),
                Name      = "namesaS",
                Surname   = "wwwwsurname1",
                Position  = "sasasDSD",
                Team      = "qwwe",
                Value_EUR = 4544444,
                IdTeam    = Guid.NewGuid()
            };

            dbContext.Players.InsertOnSubmit(expectedMember);
            dbContext.Players.InsertOnSubmit(player2);
            dbContext.SubmitChanges();
            //Act
            PlayerModel result = playerRepository.GetPlayerByID(ID);

            //Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(ID, result.IDPlayer);
            AssertUtility.AssertAreEqual(expectedMember, result);
        }