Beispiel #1
0
            private void DoAssertChecksForUpdatedValues(Cost cost, Dictionary <string, dynamic> originalValues)
            {
                var selectJoinResult = EFContext.CostFormDetails.Where(c => c.CostStageRevisionId == cost.LatestCostStageRevision.Id).Join(EFContext.CustomFormData, d => d.FormDataId, cfd => cfd.Id, (details, data) => new { data, details }).First();

                EFContext.ReloadEntity(selectJoinResult.data);

                var updatedValues = JsonConvert.DeserializeObject <Dictionary <string, dynamic> >(selectJoinResult.data.Data);

                Assert.AreNotEqual(updatedValues, originalValues);
                Assert.AreNotEqual(updatedValues["name"], originalValues["name"]);
                Assert.AreNotEqual(updatedValues["nameOfLicensor"], originalValues["nameOfLicensor"]);
                Assert.AreEqual(updatedValues["nameOfLicensor"], "New Liensor 777");
                Assert.AreEqual(updatedValues["name"], "NewName");
            }
        //[Test]
        public async Task HandleUserLoginEventObject_SSO_UPDATE_UpdateForBand04()
        {
            // setup
            const string  fileName           = "userLoginEvent_2";
            const string  approvalBandString = "04";
            const decimal approvalLimit      = 50000m;

            InitData(fileName, approvalBandString, approvalLimit, out var users, out var approvalBand, out var smo, out var userLoginEventObject);
            _userServiceMock.Setup(a => a.UpdateSessionData(It.IsAny <Sessiondata>(), It.IsAny <string>()));
            _efContext.CostUser.AddRange(users);
            _efContext.ApprovalBand.Add(approvalBand);
            _efContext.SaveChanges();

            // Act
            await _handler.Handle(userLoginEventObject);

            // Assert
            var assertUser = _efContext.CostUser.FirstOrDefault(a => a.Id == users.First(b => b.GdamUserId == "58adcba90c885409f1f47c57").Id);

            _efContext.ReloadEntity(assertUser);

            assertUser.ApprovalLimit.Should().Be(approvalBand.ApprovalLimit);
            assertUser.Band.Should().Be(approvalBand.StringBand);
        }