@@ -118,94 +118,6 @@ public async Task UpdateAsync_WithMetrics_UpdatesMetricFields(
118118 Assert . Equal ( 20 , result . PasswordAtRiskCount ) ;
119119 }
120120
121- [ Theory ]
122- [ BitAutoData ]
123- public async Task UpdateAsync_NullFields_PreservesExistingValues (
124- SutProvider < UpdateOrganizationReportV2Command > sutProvider )
125- {
126- var fixture = new Fixture ( ) ;
127- var orgId = Guid . NewGuid ( ) ;
128- var reportId = Guid . NewGuid ( ) ;
129-
130- var existingReport = fixture . Build < OrganizationReport > ( )
131- . With ( r => r . Id , reportId )
132- . With ( r => r . OrganizationId , orgId )
133- . With ( r => r . ContentEncryptionKey , "original-key" )
134- . With ( r => r . SummaryData , "original-summary" )
135- . With ( r => r . ApplicationData , "original-app-data" )
136- . With ( r => r . ApplicationCount , 5 )
137- . Without ( r => r . ReportFile )
138- . Create ( ) ;
139-
140- var request = new UpdateOrganizationReportV2Request
141- {
142- ReportId = reportId ,
143- OrganizationId = orgId ,
144- ContentEncryptionKey = null ,
145- SummaryData = null ,
146- ApplicationData = null ,
147- ReportMetrics = null
148- } ;
149-
150- sutProvider . GetDependency < IOrganizationRepository > ( )
151- . GetByIdAsync ( orgId )
152- . Returns ( fixture . Create < Organization > ( ) ) ;
153-
154- sutProvider . GetDependency < IOrganizationReportRepository > ( )
155- . GetByIdAsync ( reportId )
156- . Returns ( existingReport ) ;
157-
158- var result = await sutProvider . Sut . UpdateAsync ( request ) ;
159-
160- Assert . Equal ( "original-key" , result . ContentEncryptionKey ) ;
161- Assert . Equal ( "original-summary" , result . SummaryData ) ;
162- Assert . Equal ( "original-app-data" , result . ApplicationData ) ;
163- Assert . Equal ( 5 , result . ApplicationCount ) ;
164- }
165-
166- [ Theory ]
167- [ BitAutoData ]
168- public async Task UpdateAsync_PartialUpdate_OnlyUpdatesProvidedFields (
169- SutProvider < UpdateOrganizationReportV2Command > sutProvider )
170- {
171- var fixture = new Fixture ( ) ;
172- var orgId = Guid . NewGuid ( ) ;
173- var reportId = Guid . NewGuid ( ) ;
174-
175- var existingReport = fixture . Build < OrganizationReport > ( )
176- . With ( r => r . Id , reportId )
177- . With ( r => r . OrganizationId , orgId )
178- . With ( r => r . ContentEncryptionKey , "original-key" )
179- . With ( r => r . SummaryData , "original-summary" )
180- . With ( r => r . ApplicationData , "original-app-data" )
181- . Without ( r => r . ReportFile )
182- . Create ( ) ;
183-
184- var request = new UpdateOrganizationReportV2Request
185- {
186- ReportId = reportId ,
187- OrganizationId = orgId ,
188- SummaryData = "updated-summary" ,
189- ContentEncryptionKey = null ,
190- ApplicationData = null ,
191- ReportMetrics = null
192- } ;
193-
194- sutProvider . GetDependency < IOrganizationRepository > ( )
195- . GetByIdAsync ( orgId )
196- . Returns ( fixture . Create < Organization > ( ) ) ;
197-
198- sutProvider . GetDependency < IOrganizationReportRepository > ( )
199- . GetByIdAsync ( reportId )
200- . Returns ( existingReport ) ;
201-
202- var result = await sutProvider . Sut . UpdateAsync ( request ) ;
203-
204- Assert . Equal ( "original-key" , result . ContentEncryptionKey ) ;
205- Assert . Equal ( "updated-summary" , result . SummaryData ) ;
206- Assert . Equal ( "original-app-data" , result . ApplicationData ) ;
207- }
208-
209121 [ Theory ]
210122 [ BitAutoData ]
211123 public async Task UpdateAsync_InvalidOrganization_ThrowsBadRequestException (
@@ -214,7 +126,11 @@ public async Task UpdateAsync_InvalidOrganization_ThrowsBadRequestException(
214126 var request = new UpdateOrganizationReportV2Request
215127 {
216128 ReportId = Guid . NewGuid ( ) ,
217- OrganizationId = Guid . NewGuid ( )
129+ OrganizationId = Guid . NewGuid ( ) ,
130+ ContentEncryptionKey = "key" ,
131+ SummaryData = "summary" ,
132+ ApplicationData = "app-data" ,
133+ ReportMetrics = new OrganizationReportMetrics ( )
218134 } ;
219135
220136 sutProvider . GetDependency < IOrganizationRepository > ( )
@@ -297,7 +213,11 @@ public async Task UpdateAsync_EmptyOrganizationId_ThrowsBadRequestException(
297213 var request = new UpdateOrganizationReportV2Request
298214 {
299215 ReportId = Guid . NewGuid ( ) ,
300- OrganizationId = Guid . Empty
216+ OrganizationId = Guid . Empty ,
217+ ContentEncryptionKey = "key" ,
218+ SummaryData = "summary" ,
219+ ApplicationData = "app-data" ,
220+ ReportMetrics = new OrganizationReportMetrics ( )
301221 } ;
302222
303223 var exception = await Assert . ThrowsAsync < BadRequestException > (
@@ -313,7 +233,11 @@ public async Task UpdateAsync_EmptyReportId_ThrowsBadRequestException(
313233 var request = new UpdateOrganizationReportV2Request
314234 {
315235 ReportId = Guid . Empty ,
316- OrganizationId = Guid . NewGuid ( )
236+ OrganizationId = Guid . NewGuid ( ) ,
237+ ContentEncryptionKey = "key" ,
238+ SummaryData = "summary" ,
239+ ApplicationData = "app-data" ,
240+ ReportMetrics = new OrganizationReportMetrics ( )
317241 } ;
318242
319243 var exception = await Assert . ThrowsAsync < BadRequestException > (
0 commit comments