Пример #1
0
        public static List <StubDetail> GetStubDetail(int stubnumberid)
        {
            var dbUtil      = new DatabaseManager();
            var stubDetails = new List <StubDetail>();

            using (var conn = new SqlConnection(dbUtil.getSQLConnectionString("MainDB")))
            {
                conn.Open();
                using (SqlCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandType    = CommandType.StoredProcedure;
                    cmd.CommandText    = "spMasGetStubDetail";
                    cmd.CommandTimeout = 180;
                    cmd.Parameters.Clear();
                    cmd.Parameters.AddWithValue("@intStubNumberID", stubnumberid);

                    using (SqlDataReader reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            var stubDetail = new StubDetail
                            {
                                StubDetailID = ReferenceEquals(reader["intStubDetailID"], DBNull.Value) ? 0 : (int)reader["intStubDetailID"],
                                Number       = ReferenceEquals(reader["intNumber"], DBNull.Value) ? 0 : (int)reader["intNumber"],
                                DateUsed     = ReferenceEquals(reader["datDateUsed"], DBNull.Value) ? String.Empty : (string)reader["datDateUsed"]
                            };

                            stubDetails.Add(stubDetail);
                        }

                        return(stubDetails);
                    }
                }
            }
        }
Пример #2
0
            public void InitalizedDetail_HasDefaultValue()
            {
                // arrange
                StubDetail test = new StubDetail();

                // act

                // assert
                test.Each
                .Should()
                .BeNull();
            }
Пример #3
0
            public void InitializedDetail_HasDefaultValue()
            {
                // arrange
                StubDetail test = new StubDetail();

                // act

                // assert
                test.LineNumber
                .Should()
                .Be(0);
            }
Пример #4
0
            public void InitalizedDetail_HasDefaultValue()
            {
                // arrange
                StubDetail test     = new StubDetail();
                int        expected = 0;

                // act

                // assert
                test.HeaderId
                .Should()
                .Be(expected);
            }
Пример #5
0
            public void GoodDetail_ReturnsExpectedValue()
            {
                // arrange
                StubDetail fakeItem = MakeDetail();
                int        expected = 15;

                // act

                // assert
                fakeItem.HeaderId
                .Should()
                .Be(expected);
            }
Пример #6
0
            public void GoodDetail_ReturnsExpectedValue()
            {
                // arrange
                StubDetail fakeItem = MakeDetail();
                bool       expected = true;

                // act

                // assert
                fakeItem.Each
                .Should()
                .Be(expected);
            }
Пример #7
0
            public void GoodDetail_ReturnsExpectedValue()
            {
                // arrange
                StubDetail fakeItem = MakeDetail();
                string     expected = "Fake CatalogId";

                // act

                // assert
                fakeItem.CatalogId
                .Should()
                .Be(expected);
            }
Пример #8
0
            public void GoodDetail_ReturnsExpectedValue()
            {
                // arrange
                StubDetail fakeItem = MakeDetail();
                int        expected = 100;

                // act

                // assert
                fakeItem.LineNumber
                .Should()
                .Be(expected);
            }