Zbiór zmian 984 dla trunk/eCard/eCardMVC/adMoto.Payments.Test/Controllers/PlatnosciControllerTests.cs
- Data:
- 2009-12-28 15:17:15 (16 years ago)
- Pliki:
-
- 1 zmodyfikowane
Legenda:
- Bez zmian
- Dodane
- Usunięte
-
trunk/eCard/eCardMVC/adMoto.Payments.Test/Controllers/PlatnosciControllerTests.cs
r982 r984 22 22 private readonly TestDataHelper _testDataHelper = new TestDataHelper(); 23 23 24 //[Test]25 //[Category("Unit")]26 //public void Status_Action_Saves_Correct_Transaction()27 //{28 // //Arrange29 // var repository = new Repository<PlatnosciEcard>(new FakeDataContext());30 // var platnosci = _testDataHelper.CreateNewPayment(_orderNumber, false, DateTime.Now, 12345);31 // repository.Insert(platnosci);32 // repository.SubmitChanges();33 34 // IRepository<PotwierdzeniaEcard> rep = new Repository<PotwierdzeniaEcard>(new FakeDataContext());35 36 // var builder = new TestControllerBuilder();37 // var controller = new PlatnoscController(null, repository, rep, _translateManager);38 // builder.InitializeController(controller);39 // builder.QueryString.Add("MERCHANTNUMBER", MERCHANT_NUMBER);40 // builder.QueryString.Add("AUTHTIME", DateTime.Now.ToString());41 // builder.QueryString.Add("DATATRANSMISJI", DateTime.Now.ToString());42 // builder.QueryString.Add("ORDERNUMBER", _orderNumber.ToString());43 // builder.QueryString.Add("CURRENTSTATE", CODE_OK);44 45 // //Act46 // controller.Status();47 // System.Diagnostics.Debug.WriteLine("rep:" + rep.Count() + " repPl: " + repository.Count() );48 // var potwierdzeniaEcard = rep.Find(o => o.ORDERNUMBER == _orderNumber).SingleOrDefault();49 50 // //Assert51 // Assert.That(potwierdzeniaEcard.MERCHANTNUMBER, Is.EqualTo(MERCHANT_NUMBER));52 53 // //Act54 // var paymentAfterUpdate = repository.FindOne(_orderNumber);55 // System.Diagnostics.Debug.WriteLine("Status musi byc 'true'. Jest " + paymentAfterUpdate.Status);56 57 // //Assert58 // Assert.That(paymentAfterUpdate.Status, Is.EqualTo(true));59 //}60 61 //[Test]62 //[Category("Unit")]63 //public void Status_Action_Payment_Is_Not_Update_When_Currentstate_Is_CODE_BAD()64 //{65 // //Arrange66 // var repPayment = new Repository<PlatnosciEcard>(new FakeDataContext());67 // var platnosci = _testDataHelper.CreateNewPayment(_orderNumber, false, DateTime.Now, 12345);68 // repPayment.Insert(platnosci);69 // repPayment.SubmitChanges();70 // IRepository<PotwierdzeniaEcard> repConfirm = new Repository<PotwierdzeniaEcard>(new FakeDataContext());71 72 // var builder = new TestControllerBuilder();73 // var controller = new PlatnoscController(null, repPayment, repConfirm, _translateManager);74 // builder.InitializeController(controller);75 // builder.QueryString.Add("MERCHANTNUMBER", MERCHANT_NUMBER);76 // builder.QueryString.Add("AUTHTIME", DateTime.Now.ToString());77 // builder.QueryString.Add("DATATRANSMISJI", DateTime.Now.ToString());78 // builder.QueryString.Add("ORDERNUMBER", _orderNumber.ToString());79 // builder.QueryString.Add("CURRENTSTATE", CODE_BAD);80 81 // //Act82 // controller.Status();83 // var potwierdzeniaEcard = repConfirm.Find(o => o.ORDERNUMBER == _orderNumber).SingleOrDefault();84 85 // //Assert86 // Assert.That(potwierdzeniaEcard.MERCHANTNUMBER, Is.EqualTo(MERCHANT_NUMBER));87 88 // //Act89 // var paymentAfterUpdate = repPayment.FindOne(_orderNumber);90 // System.Diagnostics.Debug.WriteLine("Status musi byc 'false'. Jest " + paymentAfterUpdate.Status);91 92 // //Assert93 // Assert.That(paymentAfterUpdate.Status, Is.EqualTo(false));94 //}95 96 24 [Test] 97 25 [Category("Unit")] … … 100 28 //Arrange 101 29 IRepository<PlatnosciEcard> repPayment = new Repository<PlatnosciEcard>(new FakeDataContext()); 102 PlatnosciEcard p latnosc= _testDataHelper.CreateNewPayment(_orderNumber, false, _data, 1);103 repPayment.Insert(p latnosc);30 PlatnosciEcard payment = _testDataHelper.CreateNewPayment(_orderNumber, false, _data, 1); 31 repPayment.Insert(payment); 104 32 105 33 //Act … … 120 48 //Arrange 121 49 IRepository<PlatnosciEcard> repPayment = new Repository<PlatnosciEcard>(new FakeDataContext()); 122 var p latnosc= _testDataHelper.CreateNewPayment(_orderNumber, false, _data, 1);123 repPayment.Insert(p latnosc);50 var payment= _testDataHelper.CreateNewPayment(_orderNumber, false, _data, 1); 51 repPayment.Insert(payment); 124 52 125 53 var controller = new PlatnoscController(null, repPayment, null, _translateManager); … … 140 68 //Arrange 141 69 IRepository<Invoice> repVPayment = new Repository<Invoice>(new FakeDataContext()); 142 var platnosc= _testDataHelper.CreateInvoice(123, "nip1", "", 0, 0);143 repVPayment.Insert( platnosc);70 var invoice = _testDataHelper.CreateInvoice(123, "nip1", "", 0, 0); 71 repVPayment.Insert(invoice); 144 72 145 73 var controller = new PlatnoscController(repVPayment, null, null, _translateManager); … … 161 89 //Arrange 162 90 IRepository<Invoice> repVPayment = new Repository<Invoice>(new FakeDataContext()); 163 var platnosc= _testDataHelper.CreateInvoice(123, "nip2", "", 0, 0);164 repVPayment.Insert( platnosc);91 var invoice = _testDataHelper.CreateInvoice(123, "nip2", "", 0, 0); 92 repVPayment.Insert(invoice); 165 93 166 94 var controller = new PlatnoscController(repVPayment, null, null, _translateManager); … … 211 139 //Arrange 212 140 IRepository<Invoice> repVPayment = new Repository<Invoice>(new FakeDataContext()); 213 var platnosc= _testDataHelper.CreateInvoice(123, "nip1", "numer", 200, 0);214 repVPayment.Insert( platnosc);141 var invoice = _testDataHelper.CreateInvoice(123, "nip1", "numer", 200, 0); 142 repVPayment.Insert(invoice); 215 143 216 144 var repConfirm = new Repository<PotwierdzeniaEcard>(new FakeDataContext()); … … 239 167 //Arrange 240 168 IRepository<Invoice> repVPayment = new Repository<Invoice>(new FakeDataContext()); 241 var platnosc= _testDataHelper.CreateInvoice(123, "nip1", "numer", 200, 0);242 repVPayment.Insert( platnosc);169 var invoice = _testDataHelper.CreateInvoice(123, "nip1", "numer", 200, 0); 170 repVPayment.Insert(invoice); 243 171 244 172 var controller = new PlatnoscController(repVPayment, null, null, _translateManager); … … 260 188 //Arrange 261 189 IRepository<Invoice> repVPayment = new Repository<Invoice>(new FakeDataContext()); 262 var platnosc= _testDataHelper.CreateInvoice(123, "nip1", "numer", 200, 0);263 repVPayment.Insert( platnosc);190 var invoice = _testDataHelper.CreateInvoice(123, "nip1", "numer", 200, 0); 191 repVPayment.Insert(invoice); 264 192 265 193 var controller = new PlatnoscController(repVPayment, null, null, _translateManager); … … 281 209 //Arrange 282 210 IRepository<Invoice> repVPayment = new Repository<Invoice>(new FakeDataContext()); 283 var platnosc= _testDataHelper.CreateInvoice(123, "nip1", "numer", 200, 0);284 repVPayment.Insert( platnosc);285 286 var controller = new PlatnoscController(repVPayment, null, null, _translateManager); 287 controller.ControllerContext = _testDataHelper.CreateControllerContext("nip1"); 288 var name = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";289 var payer = _testDataHelper.CreatePayer(123, name, "test");211 var invoice = _testDataHelper.CreateInvoice(123, "nip1", "numer", 200, 0); 212 repVPayment.Insert(invoice); 213 214 var controller = new PlatnoscController(repVPayment, null, null, _translateManager); 215 controller.ControllerContext = _testDataHelper.CreateControllerContext("nip1"); 216 var firstname = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; 217 var payer = _testDataHelper.CreatePayer(123, firstname, "test"); 290 218 291 219 //Act … … 302 230 //Arrange 303 231 IRepository<Invoice> repVPayment = new Repository<Invoice>(new FakeDataContext()); 304 var platnosc= _testDataHelper.CreateInvoice(123, "nip1", "numer", 200, 0);305 repVPayment.Insert( platnosc);232 var invoice = _testDataHelper.CreateInvoice(123, "nip1", "numer", 200, 0); 233 repVPayment.Insert(invoice); 306 234 307 235 var controller = new PlatnoscController(repVPayment, null, null, _translateManager); … … 323 251 //Arrange 324 252 IRepository<Invoice> repVPayment = new Repository<Invoice>(new FakeDataContext()); 325 var platnosc= _testDataHelper.CreateInvoice(123, "nip1", "numer", 200, 0);326 repVPayment.Insert( platnosc);253 var invoice = _testDataHelper.CreateInvoice(123, "nip1", "numer", 200, 0); 254 repVPayment.Insert(invoice); 327 255 328 256 var controller = new PlatnoscController(repVPayment, null, null, _translateManager); … … 333 261 //Act 334 262 controller.Show(payer, "pl"); 335 263 336 264 //Assert 337 265 System.Diagnostics.Debug.WriteLine("Model powinien byc 'true'. Jest " + controller.ModelState.IsValid);
