コード例 #1
0
        public async Task Update_should_update_chargeGroup_properties()
        {
            var groups        = new ChargeGroupRepository(_fixture.DbContext);
            var capacity      = 10m;
            var name          = "TestChargeGroup";
            var chargeGroupId = Guid.NewGuid();

            var chargeGroup = new ChargeGroup(chargeGroupId, name, capacity, null);
            //add
            await groups.AddAsync(chargeGroup).ConfigureAwait(false);

            var exists = await groups.ExistsAsync(chargeGroupId).ConfigureAwait(false);

            exists.ShouldBeTrue();
            //get
            var groupFromDb = await groups.GetAsync(chargeGroupId).ConfigureAwait(false);

            groupFromDb.Id.ShouldBe(chargeGroupId);
            groupFromDb.Name.ShouldBe(name);
            groupFromDb.CapacityAmps.ShouldBe(capacity);

            capacity = 11m;
            name     = "TestChargeGroup_new";
            chargeGroup.Update(name, capacity);
            //update
            await groups.UpdateAsync(chargeGroup).ConfigureAwait(false);

            groupFromDb = await groups.GetAsync(chargeGroupId).ConfigureAwait(false);

            groupFromDb.Id.ShouldBe(chargeGroupId);
            groupFromDb.Name.ShouldBe(name);
            groupFromDb.CapacityAmps.ShouldBe(capacity);
        }
コード例 #2
0
        public async Task ExistsAsync_should_return_false_when_no_data()
        {
            var groups = new ChargeGroupRepository(_fixture.DbContext);
            var result = await groups.ExistsAsync(Guid.NewGuid()).ConfigureAwait(false);

            result.ShouldBeFalse();
        }