コード例 #1
0
        public void When_copying_record_will_create_new_object()
        {
            // Arrange
            var original_date        = DateTime.Today;
            var original_amount      = 12.34;
            var original_description = "Description";
            var original_reference   = "33334444";
            var cred_card1_record    = new CredCard1Record
            {
                Date        = original_date,
                Amount      = original_amount,
                Description = original_description,
                Reference   = original_reference
            };

            cred_card1_record.Update_source_line_for_output(',');
            var original_source_line = cred_card1_record.OutputSourceLine;

            // Act
            var copied_record = (CredCard1Record)cred_card1_record.Copy();

            copied_record.Date        = copied_record.Date.AddDays(1);
            copied_record.Amount      = copied_record.Amount + 1;
            copied_record.Description = copied_record.Description + "something else";
            copied_record.Reference   = copied_record.Reference + 1;
            copied_record.Update_source_line_for_output(',');

            // Assert
            Assert.AreEqual(original_date, cred_card1_record.Date);
            Assert.AreEqual(original_amount, cred_card1_record.Amount);
            Assert.AreEqual(original_description, cred_card1_record.Description);
            Assert.AreEqual(original_reference, cred_card1_record.Reference);
            Assert.AreEqual(original_source_line, cred_card1_record.OutputSourceLine);
        }
コード例 #2
0
        public void When_copying_record_will_copy_all_important_data()
        {
            // Arrange
            var cred_card1_record = new CredCard1Record
            {
                Date        = DateTime.Today,
                Amount      = 12.34,
                Description = "Description",
                Reference   = "33334444"
            };

            cred_card1_record.Update_source_line_for_output(',');

            // Act
            var copied_record = (CredCard1Record)cred_card1_record.Copy();

            // Assert
            Assert.AreEqual(cred_card1_record.Date, copied_record.Date);
            Assert.AreEqual(cred_card1_record.Amount, copied_record.Amount);
            Assert.AreEqual(cred_card1_record.Description, copied_record.Description);
            Assert.AreEqual(cred_card1_record.Reference, copied_record.Reference);
            Assert.AreEqual(cred_card1_record.OutputSourceLine, copied_record.OutputSourceLine);
        }