Beispiel #1
0
        public void TestGetPartners(string playerId)
        {
            _mockPartnerAccessLayer.Setup(x => x.GetPartners(new Guid(playerId))).Returns(new List <Player>()
            {
                new Player()
                {
                    Id        = new Guid("00000000-0000-0000-0000-000000000001"),
                    UserId    = new Guid("00000000-0000-0000-0001-000000000000"),
                    FirstName = "Thashin",
                    LastName  = "Naidoo",
                    Handicap  = new Decimal(19.3),
                    Created   = _createdAt,
                    Modified  = _modifiedAt
                },
                new Player()
                {
                    Id        = new Guid("00000000-0000-0000-0000-000000000002"),
                    UserId    = new Guid("00000000-0000-0000-0002-000000000000"),
                    FirstName = "Michael",
                    LastName  = "Nelmes",
                    Handicap  = new Decimal(24.8),
                    Created   = _createdAt,
                    Modified  = _modifiedAt
                }
            });

            var expected = new List <Player>()
            {
                new Player()
                {
                    Id        = new Guid("00000000-0000-0000-0000-000000000001"),
                    UserId    = new Guid("00000000-0000-0000-0001-000000000000"),
                    FirstName = "Thashin",
                    LastName  = "Naidoo",
                    Handicap  = new Decimal(19.3),
                    Created   = _createdAt,
                    Modified  = _modifiedAt
                },
                new Player()
                {
                    Id        = new Guid("00000000-0000-0000-0000-000000000002"),
                    UserId    = new Guid("00000000-0000-0000-0002-000000000000"),
                    FirstName = "Michael",
                    LastName  = "Nelmes",
                    Handicap  = new Decimal(24.8),
                    Created   = _createdAt,
                    Modified  = _modifiedAt
                }
            };

            var actual = _sut.GetPartners(new Guid(playerId)) as ObjectResult;

            actual.StatusCode.Should().Be(200);
            actual.Value.Should().BeEquivalentTo(expected);
        }
        private void BindGridView()
        {
            //SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["CustomerConnectionString2"].ConnectionString);
            //SqlCommand cmd = new SqlCommand("select * from Partner", con);
            //DataTable dt = new DataTable();
            //SqlDataAdapter da = new SqlDataAdapter(cmd);
            //da.Fill(dt);
            PartnerController partnerController = new PartnerController(ConfigurationManager.ConnectionStrings["CustomerConnectionString2"].ConnectionString.ToString());

            GridView1.DataSource = partnerController.GetPartners();
            GridView1.DataBind();
        }