Testy jednostkowe a OWIN.

0

Witam, piszę testy jednostkowe do projektu jednak większość z nich nie przechodzi z nie znanego mi powodu i na Internecie też nie dużo znalazłem a co to było to nie działa.

Problem jest taki, że wywala wyjątek System.IO.FileLoadException z zestawu Microsoft.Owin. v. 2.1.0.0
Nie wiem dokładnie kiedy taki wyjątek się pojawia. Tzn co jest przyczyną. Testy odwołują się do ApplicationDbContext a później nie wiem.

Np. taki nie przechodzi:

 Assert.Throws<KeyNotFoundException>(
                delegate
            {
                this._fixture._provider.AddPayment(-1, PaymentType.Cash, -1);
            });

A taki już tak.

 var list = this._fixture._provider.OrderStatesForInvoicing;
            Assert.NotEmpty(list); 

ASP.NET MVC, Xunit.
Testy uruchamiam na lokalnym komputerze z lokalną bazą danych.

0

A co masz w InnerException?

0

Nie ma chyba Inner.

Result Message:	
Assert.Throws() Failure
Expected: typeof(System.Collections.Generic.KeyNotFoundException)
Actual:   typeof(System.IO.FileLoadException): Nie można załadować pliku lub zestawu 'Microsoft.Owin, Version=2.1.0.0, Culture=neutral, PublicKeyToken= lub jednej z jego zależności. Zlokalizowana definicja manifestu zestawu nie odpowiada odwołaniu do zestawu. (Wyjątek od HRESULT: 0x80131040)
Result StackTrace:	
w DatabaseModel.ApplicationGroupManager..ctor()
   w DatabaseModel.Migrations.Configuration.InitializeIdentityForEF(ApplicationDbContext db) w DatabaseModel\Migrations\Configuration.cs:wiersz 316
   w Bangler.DatabaseModel.Migrations.Configuration.Seed(ApplicationDbContext context) w DatabaseModel\Migrations\Configuration.cs:wiersz 30
   w System.Data.Entity.Migrations.DbMigrationsConfiguration`1.OnSeed(DbContext context)
   w System.Data.Entity.Migrations.DbMigrator.SeedDatabase()
   w System.Data.Entity.Migrations.DbMigrator.Upgrade(IEnumerable`1 pendingMigrations, String targetMigrationId, String lastMigrationId)
   w System.Data.Entity.Migrations.DbMigrator.UpdateInternal(String targetMigration)
   w System.Data.Entity.Migrations.DbMigrator.<>c__DisplayClassc.<Update>b__b()
   w System.Data.Entity.Migrations.DbMigrator.EnsureDatabaseExists(Action mustSucceedToKeepDatabase)
   w System.Data.Entity.Migrations.DbMigrator.Update(String targetMigration)
   w System.Data.Entity.MigrateDatabaseToLatestVersion`2.InitializeDatabase(TContext context)
   w System.Data.Entity.Internal.InternalContext.<>c__DisplayClassf`1.<CreateInitializationAction>b__e()
   w System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action)
   w System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization()
   w System.Data.Entity.Internal.LazyInternalContext.<InitializeDatabase>b__4(InternalContext c)
   w System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput input)
   w System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action`1 action)
   w System.Data.Entity.Internal.LazyInternalContext.InitializeDatabase()
   w System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
   w System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
   w System.Data.Entity.Internal.Linq.InternalSet`1.Include(String path)
   w System.Data.Entity.Infrastructure.DbQuery`1.Include(String path)
   w System.Data.Entity.QueryableExtensions.Include[T](IQueryable`1 source, String path)
   w System.Data.Entity.QueryableExtensions.Include[T,TProperty](IQueryable`1 source, Expression`1 path)
   wInvoicesProvider.GetInvoiceById(Int32 id) w InvoicesProvider.cs:wiersz 176
   w InvoicesProvider.AddPayment(Int32 invoiceId, PaymentType paymentType, Decimal paymentAmount) w nvoicesProvider.cs:wiersz 206
   w InvoicesTests.<AddPayment_KeyNotFoundException>b__0() w InvoicesTest.cs:wiersz 40
   w Xunit.Assert.RecordException(Action testCode) w c:\TeamCity\buildAgent\work\74856245f07a90f0\src\xunit.assert\Asserts\Record.cs:wiersz 22

nikt nie wie?

dodanie znacznika <code class="none"> - @furious programming

1 użytkowników online, w tym zalogowanych: 0, gości: 1