public void IniatlizedItem_HasDefaultValue()
            {
                // arrange
                CustomListShare test     = new CustomListShare();
                int             expected = 0;

                // act

                // assert
                test.HeaderId
                .Should()
                .Be(expected);
            }
            public void GoodItem_ReturnsDefaultValue()
            {
                // arrange
                CustomListShare fakeItem = MakeShare();
                int             expected = 899;

                // act

                // assert
                fakeItem.HeaderId
                .Should()
                .Be(expected);
            }
            public void IniatlizedItem_HasDefaultValue()
            {
                // arrange
                CustomListShare test     = new CustomListShare();
                bool            expected = false;

                // act

                // assert
                test.Active
                .Should()
                .Be(expected);
            }
            public void GoodItem_ReturnsDefaultValue()
            {
                // arrange
                CustomListShare fakeItem = MakeShare();
                bool            expected = true;

                // act

                // assert
                fakeItem.Active
                .Should()
                .Be(expected);
            }
Esempio n. 5
0
        public long SaveCustomListShare(CustomListShare model)
        {
            DynamicParameters parms = new DynamicParameters();

            parms.Add(PARMNAME_BRANCH, model.BranchId);
            parms.Add(PARMNAME_CUSTNUM, model.CustomerNumber);
            parms.Add(PARMNAME_HEADERID, model.HeaderId);
            parms.Add(PARMNAME_RETVAL, dbType: DbType.Int64, direction: ParameterDirection.Output);

            ExecuteSPCommand(SPNAME_SAVE, parms);

            return(parms.Get <long>(PARMNAME_RETVAL));
        }
            public void NullCustomerNumber_ThrowsSqlException()
            {
                // arrange
                var repo      = MakeRepo();
                var fakeShare = new CustomListShare()
                {
                    Active      = true,
                    BranchId    = "FRT",
                    HeaderId    = 1001,
                    CreatedUtc  = new DateTime(2017, 6, 29, 13, 45, 0, DateTimeKind.Utc),
                    ModifiedUtc = new DateTime(2017, 6, 29, 13, 47, 0, DateTimeKind.Utc)
                };

                // act
                Action act = () => { repo.SaveCustomListShare(fakeShare); };

                // assert
                act.Should().Throw <SqlException>();
            }
            public void GoodId_MarksTheItemAsInactive()
            {
                // arrange
                var expected  = false;
                var fakeShare = new CustomListShare()
                {
                    Active         = true,
                    BranchId       = "FDF",
                    CustomerNumber = "999999",
                    HeaderId       = 1
                };
                var repo = MakeRepo();

                // act
                var id = repo.SaveCustomListShare(fakeShare);

                repo.DeleteCustomListShares(id);
                var test = repo.GetCustomListShare(id);

                // assert
                test.Active
                .Should()
                .Be(expected);
            }