none
Implementing the Repository Pattern with system tests RRS feed

  • Question

  • Hello,

    I am trying to implement the repository pattern with my systems tests so that I can save and review all test information at a later point. So far I have a shell of what I need to do but as of now I am stuck on where to go from here. So far I have my interfaces page, repository page done and my actual tests.

    Below is what I have so far, this is just what I am thinking, if I am not correct please correct me to additional resources that can help or correct it please! Any help I can get would be great at this point.

    Interfaces page:

     internal interface ITestRepository
        {
            void Save(string CaseName, DateTime dateTime, bool Pass);
            void Save(string CaseName, DateTime dateTime, bool Pass, object request);
            void Save(string CaseName, DateTime dateTime, bool Pass, object request, object response);
            void Save(string artifact);
        }


    Here is an example of a test case that I would take this information from:

     public class CustomerCase
        {   
            [TestCase(TestName = "CreateCustomer")]
    
            public void Case()
            {  
                var Mailing = Address.BuildAddress();
    
                var contactBill = Contact.BuildContacts(Cust.Bill());
                var contactEmerg = Contact.BuildContacts(Cust.Emerg());
                var contactPri = Contact.BuildContacts(Cust.Pri());
                var contactTechn = Contact.BuildContacts(Cust.Techn());
                var acctType = Cust.Direct();
                var Id = 0;
    
                var req = Cust.Build(user, Mailing, contactBill, contactEmerg, contactPri, contactTech, acctType, Id);
       
                var ws = new webservice;
                if (req == null) return;
                var CreateResponse = ws.Run(req) as CreateResponse;
    
                Console.WriteLine(CreateResponse);
    
                if (CreateResponse != null)
                    Assert.That(CreateResponse.Customer.AcctType, Is.EqualTo(AccountType.DIRECT));

    And here is the repository page:

     public class FileRepository : ITestRepository
        {  
            public void Save(string CaseName, DateTime dateTime, bool Pass)
            {
            }
    
            public void Save(string CaseName, DateTime dateTime, bool Pass, object request)
            {
            }
    
            public void Save(string CaseName, DateTime dateTime, bool Pass, object request, object response)
            {
            }
            
            public void Save(string artifact)
            {
            }
        }

    So here is what I have so far...any help would be appreciated!

    Thank you!

    **Also I am using the NUnit test framework**


    • Edited by compuluv Monday, April 1, 2013 7:39 PM add repo page
    • Moved by Bob Shen Tuesday, April 2, 2013 6:20 AM
    Monday, April 1, 2013 6:37 PM

All replies